From ae050524109f1ce827962665436ef7430f2ac479 Mon Sep 17 00:00:00 2001 From: David Monahan Date: Wed, 22 Mar 2023 16:48:58 +0000 Subject: IVGCVSW-7255 Update Doxygen Documentation and publish on GitHub. * Updating Doxygen documentation for 23.02 release. Signed-off-by: David Monahan Change-Id: I545574ff7664b4595d2fe6a91a3c35d2ad55df82 --- 23.02/_transpose_operator_8hpp.xhtml | 117 ++++++++++++++++++++++++++--------- 1 file changed, 87 insertions(+), 30 deletions(-) (limited to '23.02/_transpose_operator_8hpp.xhtml') diff --git a/23.02/_transpose_operator_8hpp.xhtml b/23.02/_transpose_operator_8hpp.xhtml index 33fb2b13b6..54cb20798d 100644 --- a/23.02/_transpose_operator_8hpp.xhtml +++ b/23.02/_transpose_operator_8hpp.xhtml @@ -8,7 +8,7 @@ - + ArmNN: src/backends/tosaCommon/operatorMappings/TransposeOperator.hpp File Reference @@ -19,9 +19,6 @@ - @@ -30,7 +27,8 @@ extensions: ["tex2jax.js"], jax: ["input/TeX","output/HTML-CSS"], }); - + + @@ -51,18 +49,21 @@ - + +/* @license-end */
@@ -76,7 +77,9 @@ $(function() {
@@ -108,12 +111,12 @@ $(document).ready(function(){initNavTree('_transpose_operator_8hpp.xhtml','');}) - - + +

Functions

TosaSerializationBasicBlock * ConvertTransposeToTosaOperator (const Layer *layer, const std::vector< const TensorInfo *> &inputs, const std::vector< const TensorInfo *> &outputs, const TransposeDescriptor *transposeDescriptor)
 
TosaSerializationBasicBlock * ConvertTransposeToTosaOperator (const Layer *layer, const std::vector< const TensorInfo * > &inputs, const std::vector< const TensorInfo * > &outputs, const TransposeDescriptor *transposeDescriptor)
 

Function Documentation

- -

◆ ConvertTransposeToTosaOperator()

+ +

◆ ConvertTransposeToTosaOperator()

@@ -127,13 +130,13 @@ Functions - const std::vector< const TensorInfo *> &  + const std::vector< const TensorInfo * > &  inputs, - const std::vector< const TensorInfo *> &  + const std::vector< const TensorInfo * > &  outputs, @@ -151,34 +154,88 @@ Functions

Definition at line 8 of file TransposeOperator.cpp.

- +
12 {
+
13  std::string input0Name = std::string("input0_");
+
14  std::string outputName = std::string("output0_");
+
15  std::string blockName = std::string("Op_TRANSPOSE_block_") + GetUniqueTosaMappingID();
+
16 
+
17  // If a layer is present then the block will be used for execution, so input and output names need to be determined
+
18  // using the previous and following layers so the graph is connected correctly. For validation this doesn't matter.
+
19  if(layer != nullptr)
+
20  {
+
21  // Get the layers connected to the input slot and determine unique tensor name.
+
22  Layer& connectedLayer0 = layer->GetInputSlot(0).GetConnectedOutputSlot()->GetOwningLayer();
+
23  input0Name = GenerateUniqueName(connectedLayer0, 0);
+
24 
+
25  // Determine unique output tensor name.
+
26  outputName = GenerateUniqueOutputName(*layer, 0);
+
27  }
+
28 
+
29  std::vector<int32_t> mappings(transposeDescriptor->m_DimMappings.begin(),
+
30  transposeDescriptor->m_DimMappings.end());
+
31  TosaTransposeAttribute attribute(mappings);
+
32 
+
33  auto* op = new TosaSerializationOperator(Op_TRANSPOSE,
+
34  Attribute_TransposeAttribute,
+
35  &attribute,
+
36  {input0Name},
+
37  {outputName});
+
38 
+
39 
+
40  std::vector<TosaSerializationTensor*> tensors;
+
41 
+
42  // Only add input tensors if connected layer is an input layer.
+
43  // As intermediate or constant tensors will be created separately.
+
44  // There also can't be duplicate tensor.
+
45  if(input0Name.find("input0_") != std::string::npos)
+
46  {
+
47  std::vector<int32_t> inputShape0 = GetTosaTensorShape(inputs[0]->GetShape());
+
48  DType inputDType0 = ArmNNToDType(inputs[0]->GetDataType());
+
49 
+
50  tensors.push_back(new TosaSerializationTensor(input0Name, inputShape0, inputDType0, {}));
+
51  }
+
52 
+
53  std::vector<int32_t> outputShape0 = GetTosaTensorShape(outputs[0]->GetShape());
+
54  DType outputDType0 = ArmNNToDType(outputs[0]->GetDataType());
+
55 
+
56  tensors.push_back(new TosaSerializationTensor(outputName, outputShape0, outputDType0, {}));
+
57 
+
58  // operatorInputNames/operatorOutputNames ends up being the same as
+
59  // blockInputNames/blockOutputNames for one-to-one ArmNN to TOSA mappings
+
60  return new TosaSerializationBasicBlock(blockName, // name
+
61  {op}, // operators
+
62  tensors, // tensors
+
63  {input0Name}, // inputs
+
64  {outputName}); // outputs
+
65 }
+

References PermutationVector::begin(), PermutationVector::end(), GenerateUniqueName(), GenerateUniqueOutputName(), InputSlot::GetConnectedOutputSlot(), Layer::GetInputSlot(), OutputSlot::GetOwningLayer(), GetTosaTensorShape(), GetUniqueTosaMappingID(), and TransposeDescriptor::m_DimMappings.

Referenced by GetTosaMapping().

-
12 {
13  std::string input0Name = std::string("input0_");
14  std::string outputName = std::string("output0_");
15  std::string blockName = std::string("Op_TRANSPOSE_block_") + GetUniqueTosaMappingID();
16 
17  // If a layer is present then the block will be used for execution, so input and output names need to be determined
18  // using the previous and following layers so the graph is connected correctly. For validation this doesn't matter.
19  if(layer != nullptr)
20  {
21  // Get the layers connected to the input slot and determine unique tensor name.
22  Layer& connectedLayer0 = layer->GetInputSlot(0).GetConnectedOutputSlot()->GetOwningLayer();
23  input0Name = GenerateUniqueName(connectedLayer0, 0);
24 
25  // Determine unique output tensor name.
26  outputName = GenerateUniqueOutputName(*layer, 0);
27  }
28 
29  std::vector<int32_t> mappings(transposeDescriptor->m_DimMappings.begin(),
30  transposeDescriptor->m_DimMappings.end());
31  TosaTransposeAttribute attribute(mappings);
32 
33  auto* op = new TosaSerializationOperator(Op_TRANSPOSE,
34  Attribute_TransposeAttribute,
35  &attribute,
36  {input0Name},
37  {outputName});
38 
39 
40  std::vector<TosaSerializationTensor*> tensors;
41 
42  // Only add input tensors if connected layer is an input layer.
43  // As intermediate or constant tensors will be created separately.
44  // There also can't be duplicate tensor.
45  if(input0Name.find("input0_") != std::string::npos)
46  {
47  std::vector<int32_t> inputShape0 = GetTosaTensorShape(inputs[0]->GetShape());
48  DType inputDType0 = ArmNNToDType(inputs[0]->GetDataType());
49 
50  tensors.push_back(new TosaSerializationTensor(input0Name, inputShape0, inputDType0, {}));
51  }
52 
53  std::vector<int32_t> outputShape0 = GetTosaTensorShape(outputs[0]->GetShape());
54  DType outputDType0 = ArmNNToDType(outputs[0]->GetDataType());
55 
56  tensors.push_back(new TosaSerializationTensor(outputName, outputShape0, outputDType0, {}));
57 
58  // operatorInputNames/operatorOutputNames ends up being the same as
59  // blockInputNames/blockOutputNames for one-to-one ArmNN to TOSA mappings
60  return new TosaSerializationBasicBlock(blockName, // name
61  {op}, // operators
62  tensors, // tensors
63  {input0Name}, // inputs
64  {outputName}); // outputs
65 }
std::vector< int32_t > GetTosaTensorShape(const TensorShape &shape)
-
Layer & GetOwningLayer() const
Definition: Layer.hpp:119
-
DType ArmNNToDType(const DataType &type)
-
std::string GetUniqueTosaMappingID()
-
std::string GenerateUniqueName(const Layer &layer, uint32_t layerSlot)
-
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
Definition: Layer.hpp:324
-
std::string GenerateUniqueOutputName(const Layer &layer, uint32_t layerSlot)
-
const OutputSlot * GetConnectedOutputSlot() const
Definition: Layer.hpp:56
-
ConstIterator begin() const
Definition: Types.hpp:340
-
ConstIterator end() const
Definition: Types.hpp:345
-
PermutationVector m_DimMappings
Indicates how to translate tensor elements from a given source into the target destination, when source and target potentially have different memory layouts e.g.
- -
+
+
std::string GenerateUniqueOutputName(const Layer &layer, uint32_t layerSlot)
+
const OutputSlot * GetConnectedOutputSlot() const
Definition: Layer.hpp:56
+ +
std::vector< int32_t > GetTosaTensorShape(const TensorShape &shape)
+
std::string GenerateUniqueName(const Layer &layer, uint32_t layerSlot)
+
ConstIterator begin() const
Definition: Types.hpp:340
+
Layer & GetOwningLayer() const
Definition: Layer.hpp:119
+
PermutationVector m_DimMappings
Indicates how to translate tensor elements from a given source into the target destination,...
+
DType ArmNNToDType(const DataType &type)
+
const InputSlot & GetInputSlot(unsigned int index) const override
Get a const input slot handle by slot index.
Definition: Layer.hpp:324
+
std::string GetUniqueTosaMappingID()
+
ConstIterator end() const
Definition: Types.hpp:345
-- cgit v1.2.1