MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / check_binary

Function check_binary

dnn/src/cambricon/elemwise/opr_impl.cpp:149–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149void check_binary(
150 const TensorNDArray& src, _megdnn_tensor_out dst,
151 const param::Elemwise::Mode& mode) {
152 bool mode_ok_binary = mode == Mode::ADD || mode == Mode::SUB || mode == Mode::MUL ||
153 mode == Mode::TRUE_DIV || mode == Mode::SWITCH_GT0 ||
154 mode == Mode::AND || mode == Mode::MAX || mode == Mode::MIN ||
155 mode == Mode::SIGMOID_GRAD || mode == Mode::SOFTPLUS_GRAD ||
156 mode == Mode::POW || mode == Mode::MOD ||
157 mode == Mode::FLOOR_DIV;
158 megdnn_assert(mode_ok_binary, "Elemwise unsupport mode:%d", static_cast<int>(mode));
159 auto dtype_src0 = src.at(0).layout.dtype.enumv();
160 auto dtype_src1 = src.at(1).layout.dtype.enumv();
161 auto dtype_dest = dst.layout.dtype.enumv();
162 megdnn_assert(
163 dtype_src0 == dtype_src1, "Elemwise binary dtype mismatch : %d vs %d",
164 static_cast<int>(dtype_src0), static_cast<int>(dtype_src1));
165 megdnn_assert(
166 dtype_src0 == dtype_dest, "Elemwise binary dtype mismatch : %d vs %d",
167 static_cast<int>(dtype_src0), static_cast<int>(dtype_dest));
168}
169
170void* to_contiguous(
171 cnnlHandle_t cnnl_handler, const TensorND& in,

Callers 1

execMethod · 0.85

Calls 2

enumvMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected