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

Method init_from_given_tensor

dnn/src/common/elemwise_helper.cpp:7–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5
6template <int arity>
7void ElemwiseOpParamN<arity>::init_from_given_tensor() {
8 megdnn_assert(!size && max_ndim == -1);
9 max_ndim = 0;
10 for (int i = 0; i < arity; ++i) {
11 TensorLayout& layout = param[i].layout;
12 layout = layout.collapse_contiguous();
13 auto cur = layout.total_nr_elems();
14 if (!i) {
15 size = cur;
16 } else {
17 megdnn_assert(size == cur);
18 }
19 max_ndim = std::max<int>(max_ndim, layout.ndim);
20 }
21 megdnn_assert(size > 0 && max_ndim > 0);
22}
23
24template <int arity>
25void ElemwiseOpParamN<arity>::assert_initialized() const {

Callers 11

execMethod · 0.80
make_paramMethod · 0.80
execMethod · 0.80
exec_noncontigMethod · 0.80
execMethod · 0.80
exec_noncontigMethod · 0.80
execMethod · 0.80
execMethod · 0.80
exec_noncontigMethod · 0.80
execMethod · 0.80

Calls 2

collapse_contiguousMethod · 0.80
total_nr_elemsMethod · 0.45

Tested by

no test coverage detected