13{
14 std::string outputName = std::string("constant_");
16
17 std::vector<uint8_t> uint8Data;
18
19
20
21 if(layer != nullptr)
22 {
23 outputName.append(std::to_string(layer->
GetGuid()));
24 blockName.append(std::to_string(layer->
GetGuid()));
25
27 auto tensorInfo = constantLayer->GetOutputSlot().GetTensorInfo();
28
30 }
31
32 auto* op = new TosaSerializationOperator(Op_CONST, Attribute_NONE, nullptr, {}, {outputName});
33
34 std::vector<int32_t> outputShape0;
35
36 if(isDepthwiseConv2dWeights)
37 {
38
41
42 unsigned int multiplier = outputs[0]->GetShape()[3]/inputShape[3];
43
44
45 outputShape0 = {
46 static_cast<int32_t>(outputs[0]->GetShape()[1]),
47 static_cast<int32_t>(outputs[0]->GetShape()[2]),
48 static_cast<int32_t>(inputShape[3]),
49 static_cast<int32_t>(multiplier)
50 };
51 }
52 else
53 {
55 }
56
57 DType outputDType0 =
ArmNNToDType(outputs[0]->GetDataType());
58
59
60 auto* outputTensor0 = new TosaSerializationTensor(outputName, outputShape0, outputDType0, uint8Data);
61
62 return new TosaSerializationBasicBlock(blockName,
64 {op},
65 {outputTensor0},
66 {},
67 {outputName});
68}
const std::string mainName
std::vector< uint8_t > ConvertConstantTensorDataToBuffer(const std::shared_ptr< ConstTensorHandle > &tensorHandle)
DType ArmNNToDType(const DataType &type)
std::string GetUniqueTosaMappingID()
std::vector< int32_t > GetTosaTensorShape(const TensorShape &shape)
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
const OutputSlot & GetOutputSlot(unsigned int index=0) const override
Get the const output slot handle by slot index.
LayerGuid GetGuid() const final
Returns the unique id of the layer.
const InputSlot * GetConnection(unsigned int index) const override
const TensorShape & GetShape() const
DestType PolymorphicDowncast(SourceType *value)
Polymorphic downcast for build in pointers only.