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

Method exec

dnn/src/cambricon/softmax/opr_impl.cpp:44–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42} // anonymous namespace
43
44void SoftmaxForwardImpl::exec(
45 _megdnn_tensor_in src, _megdnn_tensor_out dst, _megdnn_workspace workspace) {
46 auto dtype_dest = dst.layout.dtype.enumv();
47 megdnn_assert(
48 check_dtype_float_ieee(dtype_dest),
49 "Cambricon unsupport SoftmaxForward with dtype:%d",
50 static_cast<int>(dtype_dest));
51 auto cnnl_handler = cnnl_handle(this->handle());
52 TensorLayout reshape_layout{
53 TensorShape{init_shape(src, param().axis)}, dst.layout.dtype};
54 reshape_layout.init_contiguous_stride();
55 CnnlTensorDescriptor src_desc, dst_desc;
56 src_desc.set(reshape_layout);
57 dst_desc.set(reshape_layout);
58
59 cnnl_check(cnnlSoftmaxForward_v2(
60 cnnl_handler, cnnlSoftmaxAlgorithm_t::CNNL_SOFTMAX_ACCURATE,
61 cnnlSoftmaxMode_t::CNNL_SOFTMAX_MODE_MEDIUM_DIMENSION,
62 cnnlComputationPreference_t::CNNL_COMPUTATION_HIGH_PRECISION, nullptr,
63 src_desc.desc(), src.raw_ptr(), nullptr, dst_desc.desc(), dst.raw_ptr()));
64}
65
66//================================Softmax Backward============================
67

Callers

nothing calls this directly

Calls 9

cnnl_handleFunction · 0.85
init_shapeFunction · 0.85
paramFunction · 0.50
enumvMethod · 0.45
handleMethod · 0.45
setMethod · 0.45
descMethod · 0.45
raw_ptrMethod · 0.45

Tested by

no test coverage detected