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

Method exec

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

Source from the content-addressed store, hash-verified

644} // anonymous namespace
645
646void ElemwiseForwardImpl::exec(const TensorNDArray& src, _megdnn_tensor_out dst) {
647 WorkspaceBundle wk_bundle = alloc_cnnl_workspace(src, dst);
648 auto handle = concrete_handle(this->handle());
649 auto mode = m_param.mode;
650 int nr_operands = src.size();
651 if (nr_operands == 1) { // unary mode
652 check_unary(src, dst, mode);
653 exec_unary(handle, src.at(0), dst, mode, wk_bundle);
654 } else if (nr_operands == 2) { // binary mode
655 check_binary(src, dst, mode);
656 exec_binary(handle, src.at(0), src.at(1), dst, mode, wk_bundle);
657 } else if (nr_operands == 3) {
658 check_ternary(src, dst, mode);
659 exec_ternary(handle, src.at(0), src.at(1), src.at(2), dst, mode, wk_bundle);
660 } else {
661 megdnn_throw("elemwise unsupport mode");
662 }
663 free_cnnl_workspace(wk_bundle);
664}
665
666namespace {
667

Callers

nothing calls this directly

Calls 10

check_unaryFunction · 0.85
exec_unaryFunction · 0.85
check_binaryFunction · 0.85
exec_binaryFunction · 0.85
check_ternaryFunction · 0.85
exec_ternaryFunction · 0.85
concrete_handleFunction · 0.50
handleMethod · 0.45
sizeMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected