| 9 | using namespace BareMetal; |
| 10 | |
| 11 | bool WarpPerspectiveKernel::IsAvailable(TContext* ctx) const { |
| 12 | auto nr_operands = ctx->getAttrInt("nr_operands"); |
| 13 | auto src_layout = ctx->getAttrOprand("operand:0"); |
| 14 | auto mat_layout = ctx->getAttrOprand("operand:1"); |
| 15 | auto dst_layout = ctx->getAttrOprand("operand:2"); |
| 16 | if (nr_operands == 4) { |
| 17 | dst_layout = ctx->getAttrOprand("operand:3"); |
| 18 | } else { |
| 19 | CC_ASSERT(nr_operands == 3); |
| 20 | } |
| 21 | bool dtype_valid = (src_layout.dtype == "f32" || src_layout.dtype == "ui8" || |
| 22 | src_layout.dtype == "f16") && |
| 23 | mat_layout.dtype == "f32" && |
| 24 | dst_layout.dtype == src_layout.dtype; |
| 25 | bool shape_valid = |
| 26 | (nr_operands == 3 && src_layout.shape[0] == mat_layout.shape[0] && |
| 27 | src_layout.shape[0] == dst_layout.shape[0]) || |
| 28 | (nr_operands == 4); |
| 29 | bool imode_valid = (ctx->getAttrStr("imode") == "LINEAR"); |
| 30 | return dtype_valid && shape_valid && imode_valid; |
| 31 | } |
| 32 | //! kernel gen |
| 33 | std::string WarpPerspectiveKernel::GetKernelSymbol(TContext* ctx) const { |
| 34 | std::stringstream ss; |
nothing calls this directly
no test coverage detected