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

Method exec

dnn/src/cuda/where/where_backward.cpp:9–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7namespace cuda {
8
9void WhereBackwardImpl::exec(
10 _megdnn_tensor_in diff, _megdnn_tensor_in mask, _megdnn_tensor_out grad_data1,
11 _megdnn_tensor_out grad_data2, _megdnn_workspace workspace) {
12 check_exec(
13 diff.layout, mask.layout, grad_data1.layout, grad_data2.layout,
14 workspace.size);
15 auto stream = cuda_stream(this->handle());
16 auto n = diff.layout.total_nr_elems();
17#define cb(DType) \
18 if (diff.layout.dtype == DType()) { \
19 using ctype = typename DTypeTrait<DType>::ctype; \
20 where_backward::backward_proxy<ctype>( \
21 diff.ptr<ctype>(), mask.ptr<dt_bool>(), grad_data1.ptr<ctype>(), \
22 grad_data2.ptr<ctype>(), n, stream); \
23 }
24 MEGDNN_FOREACH_COMPUTING_DTYPE(cb)
25 cb(::megdnn::dtype::Bool)
26#undef cb
27}
28
29} // namespace cuda
30} // namespace megdnn

Callers

nothing calls this directly

Calls 4

cuda_streamFunction · 0.85
cbFunction · 0.50
handleMethod · 0.45
total_nr_elemsMethod · 0.45

Tested by

no test coverage detected