1919#include " Swizzle.h"
2020#include " ir/DataType.h"
2121#include " ir/operation/ElementwiseActivation.h"
22+ #include < util/Exceptions.h>
2223#include < memory>
2324
2425namespace onert ::backend::acl_common
@@ -96,8 +97,7 @@ ::arm_compute::DataType asDataType(const ir::DataType type)
9697 case ir::DataType::QUANT_INT8_SYMM_PER_CHANNEL:
9798 return ::arm_compute::DataType::QSYMM8_PER_CHANNEL;
9899 default :
99- throw std::runtime_error (" Not supported internal data type, yet" );
100- break ;
100+ throw UnsupportedDataTypeException (type);
101101 }
102102}
103103
@@ -224,7 +224,8 @@ std::set<uint32_t> asSet(const ir::Operand &operand, int32_t rank)
224224 for (size_t i = 0 ; i < operand.shape ().num_elements (); ++i)
225225 {
226226 int32_t axis = 0 ;
227- switch (operand.typeInfo ().type ())
227+ const auto data_type = operand.typeInfo ().type ();
228+ switch (data_type)
228229 {
229230 case ir::DataType::INT32:
230231 axis = reinterpret_cast <const int32_t *>(operand.data ()->base ())[i];
@@ -233,7 +234,7 @@ std::set<uint32_t> asSet(const ir::Operand &operand, int32_t rank)
233234 axis = reinterpret_cast <const int64_t *>(operand.data ()->base ())[i];
234235 break ;
235236 default :
236- throw std::runtime_error ( " acl_common:: asSet: Not supported data type " );
237+ throw UnsupportedDataTypeException ( " asSet" , data_type );
237238 }
238239 if (axis < 0 )
239240 axis += rank;
@@ -273,8 +274,7 @@ ir::DataType asRuntimeDataType(::arm_compute::DataType data_type)
273274 case ::arm_compute::DataType::QSYMM16:
274275 return ir::DataType::QUANT_INT16_SYMM;
275276 default :
276- throw std::runtime_error{" Not supported acl data type, yet" };
277- break ;
277+ throw UnsupportedDataTypeException (" asRuntimeDataType" , data_type);
278278 }
279279}
280280
@@ -312,7 +312,8 @@ arm_compute::PixelValue asPixelValue(const ir::Operand &operand)
312312{
313313 assert (operand.isConstant ());
314314 assert (operand.shape ().num_elements () == 1 );
315- switch (operand.typeInfo ().type ())
315+ const auto data_type = operand.typeInfo ().type ();
316+ switch (data_type)
316317 {
317318 case ir::DataType::INT32:
318319 return arm_compute::PixelValue (operand.asScalar <int32_t >());
@@ -325,7 +326,7 @@ arm_compute::PixelValue asPixelValue(const ir::Operand &operand)
325326 case ir::DataType::FLOAT32:
326327 return arm_compute::PixelValue (operand.asScalar <float >());
327328 default :
328- throw std::runtime_error (" asPixelValue : Not supported datatype yet " );
329+ throw UnsupportedDataTypeException (" asPixelValue" , data_type );
329330 }
330331}
331332
0 commit comments