29 if (std::find(broadcastOps.begin(), broadcastOps.end(), layer.
GetType()) != broadcastOps.end())
42 unsigned int reshapeSlot = 1;
49 reshapeInfo = inputInfo0;
50 inputInfo = inputInfo1;
55 std::vector<unsigned> reshapedDim;
58 reshapedDim.push_back(reshapeInfo.
GetShape()[i]);
61 std::vector<unsigned int> reshapedDimensions(numDimensions, 1);
62 std::copy_backward(reshapedDim.begin(), reshapedDim.end(), reshapedDimensions.end());
69 bool elementWiseMul =
false;
79 (parentName.find(
"Quantize")!=std::string::npos && elementWiseMul)))
83 constantLayer.
m_LayerOutput = std::make_unique<ScopedTensorHandle>(
89 const std::string layerName =
"Reshape_for:" + layer.
GetNameStr() +
"-" + std::to_string(reshapeSlot);
A tensor defined by a TensorInfo (shape and data type) and an immutable backing store.
A layer that the constant data can be bound to.
std::shared_ptr< ConstTensorHandle > m_LayerOutput
LayerT * InsertNewLayer(InputSlot &insertBefore, Args &&... args)
Inserts a new layer between the output slot currently connected to insertBefore and insertBefore itse...
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
const std::string & GetNameStr() const
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
const char * GetName() const override
Returns the name of the layer.
LayerType GetType() const override
Returns the armnn::LayerType of this layer.
unsigned int GetNumConnections() const override
void SetTensorInfo(const TensorInfo &tensorInfo) override
Layer & GetOwningLayer() const
bool IsTensorInfoSet() const override
const TensorInfo & GetTensorInfo() const override
This layer represents a reshape operation.
const TensorShape & GetShape() const
unsigned int GetNumDimensions() const
void SetShape(const TensorShape &newShape)
~AddBroadcastReshapeLayerImpl()=default
void Run(Graph &graph, Layer &layer) const
Run for every ElementwiseBaseLayer. Add Broadcast reshape layer if the inputs shape are different.
AddBroadcastReshapeLayerImpl()=default
OptimizeForType< Layer, AddBroadcastReshapeLayerImpl > AddBroadcastReshapeLayer
Copyright (c) 2021 ARM Limited and Contributors.
DestType PolymorphicDowncast(SourceType *value)
Polymorphic downcast for build in pointers only.
A ReshapeDescriptor for the ReshapeLayer.