| 484 | } |
| 485 | |
| 486 | void check_ternary( |
| 487 | const TensorNDArray& src, _megdnn_tensor_out dst, |
| 488 | const param::Elemwise::Mode& mode) { |
| 489 | bool mode_ok_ternary = mode == Mode::COND_LEQ_MOV || mode == Mode::COND_LT_MOV || |
| 490 | mode == Mode::CLIP || mode == Mode::FUSE_MUL_ADD3; |
| 491 | |
| 492 | megdnn_assert( |
| 493 | mode_ok_ternary, "Elemwise unsupport mode:%d", static_cast<int>(mode)); |
| 494 | auto dtype_src0 = src.at(0).layout.dtype.enumv(); |
| 495 | auto dtype_src1 = src.at(1).layout.dtype.enumv(); |
| 496 | auto dtype_src2 = src.at(2).layout.dtype.enumv(); |
| 497 | auto dtype_dest = dst.layout.dtype.enumv(); |
| 498 | megdnn_assert( |
| 499 | dtype_src0 == dtype_src1 && dtype_src0 == dtype_src2, |
| 500 | "Elemwise ternary dtype mismatch : %d vs %d vs %d", |
| 501 | static_cast<int>(dtype_src0), static_cast<int>(dtype_src1), |
| 502 | static_cast<int>(dtype_src2)); |
| 503 | megdnn_assert( |
| 504 | dtype_src0 == dtype_dest, "Elemwise ternary dtype mismatch : %d vs %d", |
| 505 | static_cast<int>(dtype_src0), static_cast<int>(dtype_dest)); |
| 506 | } |
| 507 | |
| 508 | void exec_ternary( |
| 509 | HandleImpl* handle, const TensorND& src0, const TensorND& src1, |