14 using namespace armnn;
17 TEST_CASE(
"ConvertConstPermuteToConst")
20 const unsigned int shape[] = {1, 2, 2, 3};
25 std::vector<float> constantValues(constTensorInfo.GetNumElements(), 4.5f);
26 ConstTensor constTensor(constTensorInfo, constantValues.data());
27 constant->
m_LayerOutput = std::make_shared<ScopedTensorHandle>(constTensor);
33 permuteLayer->GetOutputSlot().SetTensorInfo(infoPermuted);
39 permuteLayer->GetOutputSlot().Connect(output->
GetInputSlot(0));
42 &IsLayerOfType<ConstantLayer>,
43 &IsLayerOfType<PermuteLayer>,
44 &IsLayerOfType<OutputLayer>));
49 &IsLayerOfType<ConstantLayer>,
50 &IsLayerOfType<OutputLayer>));
53 CHECK(tensorShape[0] == shape[0]);
54 CHECK(tensorShape[1] == shape[3]);
55 CHECK(tensorShape[2] == shape[1]);
56 CHECK(tensorShape[3] == shape[2]);
A layer that the constant data can be bound to.
const TensorShape & GetShape() const
Optimizer::Optimizations MakeOptimizations(Args &&... args)
bool CheckSequence(const armnn::Graph::ConstIterator first, const armnn::Graph::ConstIterator last)
std::shared_ptr< ConstTensorHandle > m_LayerOutput
LayerT * AddLayer(Args &&... args)
Adds a new layer, of type LayerType, to the graph constructed with the arguments passed.
ConstIterator cbegin() const
Returns const iterator pointing to the beginning of the list. Lowercase for range-based for loops...
int Connect(InputSlot &destination)
static void Pass(Graph &graph, const Optimizations &optimizations)
Copyright (c) 2021 ARM Limited and Contributors.
This layer represents a permutation operation.
OptimizeForConnection< ConstantLayer, PermuteLayer, ConvertConstPermuteLayersToConstLayers > FusePermuteIntoConstLayer
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
A layer user-provided data can be bound to (e.g. inputs, outputs).
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
void SetTensorInfo(const TensorInfo &tensorInfo) override
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
ConstIterator cend() const
Returns const iterator pointing to the end of the list. Lowercase for range-based for loops...
const TensorInfo & GetTensorInfo() const override
armnn::TensorShape Permuted(const armnn::TensorShape &srcShape, const armnn::PermutationVector &mappings)
A PermuteDescriptor for the PermuteLayer.