diff options
author | Matthew Sloyan <matthew.sloyan@arm.com> | 2021-08-09 15:33:41 +0100 |
---|---|---|
committer | Matthew Sloyan <matthew.sloyan@arm.com> | 2021-08-09 21:51:27 +0100 |
commit | b20d1d4888c270d4d57a0bdcc011ded89a2f5b38 (patch) | |
tree | e4d5d3b5b5ae7ac0148c65e71d03ad9b2859df08 /samples/SimpleSample.cpp | |
parent | cd92c9c3835f4e5d1677b3f3aaae9e49a62bd537 (diff) | |
download | armnn-b20d1d4888c270d4d57a0bdcc011ded89a2f5b38.tar.gz |
IVGCVSW-6119 ConstTensorsAsInput: FullyConnected Bug Fix
* Updated FullyConnected layer member variables when cloning as
some backends still require them.
* Added SetConstant call when using deprecated AddFullyConnectedLayer
method to ensure backwards compatibility.
* Added SetConstant to SimpleSample to ensure it runs on all backends.
Signed-off-by: Matthew Sloyan <matthew.sloyan@arm.com>
Change-Id: Ie7b4e4b868f23f8fcf9c41ffd12e2ea9ea53afca
Diffstat (limited to 'samples/SimpleSample.cpp')
-rw-r--r-- | samples/SimpleSample.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/samples/SimpleSample.cpp b/samples/SimpleSample.cpp index 6bdc2983bb..3f94b53ca1 100644 --- a/samples/SimpleSample.cpp +++ b/samples/SimpleSample.cpp @@ -29,6 +29,7 @@ int main() float weightsData[] = {1.0f}; // Identity TensorInfo weightsInfo(TensorShape({1, 1}), DataType::Float32); + weightsInfo.SetConstant(); ConstTensor weights(weightsInfo, weightsData); // Constant layer that now holds weights data for FullyConnected @@ -54,7 +55,7 @@ int main() TensorInfo outputTensorInfo(TensorShape({1, 1}), DataType::Float32); fullyConnectedLayer->GetOutputSlot(0).SetTensorInfo(outputTensorInfo); - constantWeightsLayer->GetOutputSlot(0).SetTensorInfo(outputTensorInfo); + constantWeightsLayer->GetOutputSlot(0).SetTensorInfo(weightsInfo); // Optimise ArmNN network IOptimizedNetworkPtr optNet = Optimize(*myNetwork, {Compute::CpuRef}, run->GetDeviceSpec()); |