20 static bool IsTosaLayerSupported(TosaSerializationOperator* op,
21 const std::vector<TosaSerializationTensor*>& inputs,
22 const std::vector<TosaSerializationTensor*>& outputs,
29 bool supported =
true;
31 std::array<Attribute, 1> supportedAttributes =
38 std::string(
"TOSA Reference addition: operator has an unsupported attribute.").c_str());
40 std::array<DType, 9> supportedTypes =
53 for (
auto tensor : inputs)
58 std::string(
"TOSA Reference addition: " + tensor->GetName() +
59 " is not a supported type.").c_str());
64 std::string(
"Tosa Reference addition: " + tensor->GetName() +
" Shape.Size()" 65 " outside bounds of between Zero and MaxNumOfTensorDimensions.").c_str());
71 std::string(
"TOSA Reference addition: " + outputs[0]->GetName() +
72 " is not a supported type.").c_str());
77 std::string(
"Tosa Reference addition: " + outputs[0]->GetName() +
" Shape.Size()" 78 " outside bounds of between Zero and MaxNumOfTensorDimensions.").c_str());
83 SetValueChecked(reasonIfUnsupported,
"Operation is currently unsupported by the TOSA Reference Backend.");
89 const std::vector<TensorInfo>& infos,
98 std::vector<const TensorInfo*> inputInfos;
99 std::vector<const TensorInfo*> outputInfos;
105 inputInfos.push_back(&infos[0]);
106 inputInfos.push_back(&infos[1]);
107 outputInfos.push_back(&infos[2]);
116 auto mappings =
GetTosaMapping(type, inputInfos, outputInfos, descriptor,
false);
117 if (mappings->GetName() ==
"")
124 for (
long unsigned int i = 0; i < mappings->GetOperators().size(); ++i)
127 if (mappings->GetOperators()[i]->GetOp() == tosa::Op_UNKNOWN) {
return false; }
131 std::vector<TosaSerializationTensor*> inputTensorsVect;
132 for (
const auto& name : mappings->GetOperators()[i]->GetInputTensorNames())
134 inputTensorsVect.push_back(mappings->GetTensorByName(name));
137 std::vector<TosaSerializationTensor*> outputTensorsVect;
138 for (
const auto& name : mappings->GetOperators()[i]->GetOutputTensorNames())
140 outputTensorsVect.push_back(mappings->GetTensorByName(name));
143 if (!IsTosaLayerSupported(mappings->GetOperators()[i],
bool IsLayerSupported(const LayerType &type, const std::vector< TensorInfo > &infos, const BaseDescriptor &descriptor, const Optional< LstmInputParamsInfo > &lstmParamsInfo, const Optional< QuantizedLstmInputParamsInfo > &, Optional< std::string &> reasonIfUnsupported) const override
const TensorInfo const ActivationDescriptor Optional< std::string & > reasonIfUnsupported
Copyright (c) 2021 ARM Limited and Contributors.
TosaSerializationBasicBlock * GetTosaMapping(const LayerType type, const std::vector< const TensorInfo *> &inputs, const std::vector< const TensorInfo *> &outputs, const BaseDescriptor &, bool isMain=false)
void IgnoreUnused(Ts &&...)
Base class for all descriptors.
void SetValueChecked(Optional< T &> optionalRef, V &&val)
bool CheckSupportRule(F rule, Optional< std::string &> reasonIfUnsupported, const char *reason)
LayerType
When adding a new layer, adapt also the LastLayer enum value in the enum class LayerType below...