From 5d7b0a314b3e354a6cbcf15f5dd78b50f1e02774 Mon Sep 17 00:00:00 2001 From: Matthew Sloyan Date: Mon, 18 Oct 2021 13:07:49 +0100 Subject: Add ConstTensorsAsInput support for Conv3d * Constant weights and biases are now stored as Constant layers. * Updated Serializer, Deserializer and unit tests to reflect this. * Updated TfLiteParser. * Updated Ref backend to handle constant weights and bias as inputs rather than reading from member variables. * Added Conv3d EndToEnd test. * Added NCDHW DataLayout and unit tests. Signed-off-by: Matthew Sloyan Change-Id: I10cdd354ca5f1c748730f92ffdb36bf810f83c8e --- .../test/DeserializeConvolution3d.cpp | 92 ++++++++++++++-------- 1 file changed, 60 insertions(+), 32 deletions(-) (limited to 'src/armnnDeserializer/test') diff --git a/src/armnnDeserializer/test/DeserializeConvolution3d.cpp b/src/armnnDeserializer/test/DeserializeConvolution3d.cpp index 057ab6fbda..23fd811cdb 100644 --- a/src/armnnDeserializer/test/DeserializeConvolution3d.cpp +++ b/src/armnnDeserializer/test/DeserializeConvolution3d.cpp @@ -30,13 +30,11 @@ struct Convolution3dFixture : public ParserFlatbuffersSerializeFixture base: { layerName: "InputLayer", layerType: "Input", - inputSlots: [{ - index: 0, - connection: {sourceLayerIndex:0, outputSlotIndex:0 }, - }], + inputSlots: [ + + ], outputSlots: [ { - index: 0, tensorInfo: { dimensions: )" + inputShape + R"(, dataType: )" + dataType + R"(, @@ -56,26 +54,19 @@ struct Convolution3dFixture : public ParserFlatbuffersSerializeFixture } }, { - layer_type: "Convolution3dLayer", + layer_type: "ConstantLayer", layer: { base: { index: 1, - layerName: "convolution3d", - layerType: "Convolution2d", + layerName: "Weights", + layerType: "Constant", inputSlots: [ - { - index: 0, - connection: { - sourceLayerIndex: 0, - outputSlotIndex: 0 - } - } + ], outputSlots: [ { - index: 0, tensorInfo: { - dimensions: )" + outputShape + R"(, + dimensions: )" + weightsShape + R"(, dataType: )" + dataType + R"(, quantizationScale: 0.1, dimensionSpecificity: [ @@ -89,12 +80,7 @@ struct Convolution3dFixture : public ParserFlatbuffersSerializeFixture } ] }, - descriptor: { - strideX: 2, - strideY: 2, - strideZ: 2 - }, - weights: { + input: { info: { dimensions: )" + weightsShape + R"(, dataType: )" + dataType + R"(, @@ -126,30 +112,72 @@ struct Convolution3dFixture : public ParserFlatbuffersSerializeFixture } } }, + { + layer_type: "Convolution3dLayer", + layer: { + base: { + index: 2, + layerName: "convolution3d", + layerType: "Convolution3d", + inputSlots: [ + { + connection: { + sourceLayerIndex: 0, + outputSlotIndex: 0 + } + }, + { + index: 1, + connection: { + sourceLayerIndex: 1, + outputSlotIndex: 0 + } + } + ], + outputSlots: [ + { + tensorInfo: { + dimensions: )" + outputShape + R"(, + dataType: )" + dataType + R"(, + quantizationScale: 0.1, + dimensionSpecificity: [ + true, + true, + true, + true, + true + ] + } + } + ] + }, + descriptor: { + strideX: 2, + strideY: 2, + strideZ: 2 + } + } + }, { layer_type: "OutputLayer", layer: { base: { layerBindingId: 2, base: { - index: 2, + index: 3, layerName: "OutputLayer", layerType: "Output", inputSlots: [ { connection: { - sourceLayerIndex: 1, + sourceLayerIndex: 2, outputSlotIndex: 0 } } ], - outputSlots: [{ - index: 0, - tensorInfo: { - dimensions: )" + outputShape + R"(, - dataType: )" + dataType + R"( - }, - }] + outputSlots: [ + + ] } } } -- cgit v1.2.1