| 185 | } |
| 186 | |
| 187 | void* 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 | |
| 202 | template <typename T> |
| 203 | void opTensorRun( |
no test coverage detected