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

Function to_contiguous

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

Source from the content-addressed store, hash-verified

168}
169
170void* to_contiguous(
171 cnnlHandle_t cnnl_handler, const TensorND& in,
172 const CnnlTensorDescriptor& src_desc, CnnlTensorDescriptor& dst_desc,
173 Workspace wk, size_t offset = 0) {
174 TensorLayout dst_layout = in.layout;
175 dst_layout.init_contiguous_stride();
176 dst_desc.set(dst_layout);
177 if (in.layout.is_contiguous()) {
178 return in.raw_ptr();
179 }
180 megdnn_assert(dst_layout.access_bytes() <= wk.size);
181 cnnl_check(cnnlCopy(
182 cnnl_handler, src_desc.desc(), in.raw_ptr(), dst_desc.desc(),
183 wk.ptr<void>(offset)));
184 return wk.ptr<void>(offset);
185}
186
187void* to_broadcast(
188 cnnlHandle_t cnnl_handler, const TensorND& in, const TensorLayout& dst_layout,

Callers 2

exec_binaryFunction · 0.85
exec_ternaryFunction · 0.85

Calls 6

access_bytesMethod · 0.80
setMethod · 0.45
is_contiguousMethod · 0.45
raw_ptrMethod · 0.45
descMethod · 0.45

Tested by

no test coverage detected