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

Function to_broadcast

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

Source from the content-addressed store, hash-verified

185}
186
187void* to_broadcast(
188 cnnlHandle_t cnnl_handler, const TensorND& in, const TensorLayout& dst_layout,
189 const CnnlTensorDescriptor& src_desc, Workspace wk, size_t offset = 0) {
190 CnnlTensorDescriptor dst_desc;
191 dst_desc.set(dst_layout);
192 if (in.layout.eq_layout(dst_layout)) {
193 return in.raw_ptr();
194 }
195 megdnn_assert(dst_layout.access_bytes() <= wk.size);
196 cnnl_check(cnnlExpand(
197 cnnl_handler, src_desc.desc(), in.raw_ptr(), dst_desc.desc(),
198 wk.ptr<void>(offset)));
199 return wk.ptr<void>(offset);
200}
201
202template <typename T>
203void opTensorRun(

Callers 2

exec_binaryFunction · 0.85
exec_ternaryFunction · 0.85

Calls 5

eq_layoutMethod · 0.80
access_bytesMethod · 0.80
setMethod · 0.45
raw_ptrMethod · 0.45
descMethod · 0.45

Tested by

no test coverage detected