| 168 | } |
| 169 | |
| 170 | void* 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 | |
| 187 | void* to_broadcast( |
| 188 | cnnlHandle_t cnnl_handler, const TensorND& in, const TensorLayout& dst_layout, |
no test coverage detected