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

Method make_bundle

dnn/src/cambricon/argmxx/opr_impl.cpp:25–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23};
24
25WorkspaceBundle ArgmaxForwardImpl::make_bundle(
26 const TensorLayout& src, const TensorLayout& dst) {
27 auto handle = concrete_handle(this->handle());
28 size_t topk_ws = 0;
29 ArgmxxCnnlDescs descs(src, dst, param().axis);
30 cnnl_check(cnnlGetTopKTensorWorkspaceSize(
31 /* handle */ handle->cnnl_handle(),
32 /* input_desc */ descs.src_desc.desc(),
33 /* k */ descs.k,
34 /* dim */ param().axis,
35 /* largest */ true,
36 /* output_desc */ descs.out_value_desc.desc(),
37 /* index_desc */ descs.out_indices_desc.desc(),
38 /* workspace_size */ &topk_ws));
39 size_t value_ws = dst.span().dist_elem() * src.dtype.size();
40 size_t src_ws = 0;
41 if (!src.is_contiguous()) {
42 src_ws = src.access_bytes();
43 }
44 return {nullptr, {topk_ws, value_ws, src_ws}, handle->alignment_requirement()};
45}
46
47size_t ArgmaxForwardImpl::get_workspace_in_bytes(
48 const TensorLayout& src, const TensorLayout& dst) {

Callers

nothing calls this directly

Calls 11

cnnl_handleMethod · 0.80
dist_elemMethod · 0.80
spanMethod · 0.80
access_bytesMethod · 0.80
concrete_handleFunction · 0.50
paramFunction · 0.50
handleMethod · 0.45
descMethod · 0.45
sizeMethod · 0.45
is_contiguousMethod · 0.45
alignment_requirementMethod · 0.45

Tested by

no test coverage detected