| 13 | using namespace BareMetal; |
| 14 | |
| 15 | bool PoolingKernel::IsAvailable(TContext* context) const { |
| 16 | bool mode_ok = context->getAttrStr("format") == "NCHW"; |
| 17 | auto src_dtype = context->getAttrOprand("operand:0").dtype; |
| 18 | auto dst_dtype = context->getAttrOprand("operand:1").dtype; |
| 19 | bool dtype_ok = (src_dtype == dst_dtype) && (Utils::is_float_dtype(src_dtype) || |
| 20 | Utils::is_float_dtype(src_dtype, 16) || |
| 21 | Utils::is_quant_dtype(src_dtype)); |
| 22 | if (Utils::is_quant_dtype(src_dtype)) { |
| 23 | CC_ASSERT( |
| 24 | context->getAttrOprand("operand:0").scale == |
| 25 | context->getAttrOprand("operand:1").scale) |
| 26 | << "quant pooling only support same scale\n"; |
| 27 | } |
| 28 | return mode_ok && dtype_ok; |
| 29 | } |
| 30 | //! kernel gen |
| 31 | std::string PoolingImpl::GetKernelSymbol(TContext* context) const { |
| 32 | std::stringstream ss; |
nothing calls this directly
no test coverage detected