| 12 | using namespace ArmCommon; |
| 13 | |
| 14 | bool TypecvtKernel::IsAvailable(TContext* context) const { |
| 15 | auto src_dtype = |
| 16 | SymbolHelper::gen_valid_dtype(context->getAttrOprand("operand:0").dtype); |
| 17 | auto dst_dtype = |
| 18 | SymbolHelper::gen_valid_dtype(context->getAttrOprand("operand:1").dtype); |
| 19 | bool ok_type = |
| 20 | (Utils::is_quant_dtype(src_dtype, 8) && |
| 21 | Utils::is_quant_dtype(dst_dtype, 8)) || |
| 22 | (Utils::is_quant_dtype(src_dtype, 8) && Utils::is_float_dtype(dst_dtype)) || |
| 23 | (Utils::is_float_dtype(src_dtype) && Utils::is_quant_dtype(dst_dtype, 8)) || |
| 24 | (Utils::get_dtype_enum(src_dtype) == Utils::DtypeEnum::uint8 && |
| 25 | Utils::is_float_dtype(dst_dtype)); |
| 26 | if (Utils::is_quant_dtype(src_dtype)) { |
| 27 | CC_ASSERT(context->getAttrOprand("operand:0").scale > 0); |
| 28 | } |
| 29 | if (Utils::is_quant_dtype(dst_dtype)) { |
| 30 | CC_ASSERT(context->getAttrOprand("operand:1").scale > 0); |
| 31 | } |
| 32 | return ok_type; |
| 33 | } |
| 34 | |
| 35 | //! kernel gen |
| 36 | std::string TypecvtKernel::GetKernelSymbol(TContext* context) const { |
nothing calls this directly
no test coverage detected