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

Function copy_general

dnn/src/cambricon/relayout/opr_impl.cpp:266–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

264}
265
266void copy_general(
267 _megdnn_tensor_in src, _megdnn_tensor_out dst, RelayoutForwardImpl* opr,
268 bool cross_dev, int src_dev_id, int dst_dev_id) {
269 // TODO: support different types of src and dst.
270 if (src.layout.dtype != dst.layout.dtype) {
271 megdnn_throw(
272 "src type is not equal to dst type in relayout forward on cambricon.");
273 }
274
275 if (dst.layout.dtype.enumv() == DTypeEnum::Float32) {
276 copy_general_interior<dt_float32>(
277 src, dst, opr, cross_dev, src_dev_id, dst_dev_id);
278 } else if (dst.layout.dtype.enumv() == DTypeEnum::Float16) {
279 copy_general_interior<dt_float16>(
280 src, dst, opr, cross_dev, src_dev_id, dst_dev_id);
281 } else if (dst.layout.dtype.enumv() == DTypeEnum::Int32) {
282 copy_general_interior<dt_int32>(
283 src, dst, opr, cross_dev, src_dev_id, dst_dev_id);
284 } else if (dst.layout.dtype.enumv() == DTypeEnum::Int16) {
285 copy_general_interior<dt_int16>(
286 src, dst, opr, cross_dev, src_dev_id, dst_dev_id);
287 } else if (dst.layout.dtype.enumv() == DTypeEnum::Uint16) {
288 copy_general_interior<dt_uint16>(
289 src, dst, opr, cross_dev, src_dev_id, dst_dev_id);
290 } else if (dst.layout.dtype.enumv() == DTypeEnum::Int8) {
291 copy_general_interior<dt_int8>(
292 src, dst, opr, cross_dev, src_dev_id, dst_dev_id);
293 } else if (dst.layout.dtype.enumv() == DTypeEnum::Uint8) {
294 copy_general_interior<dt_uint8>(
295 src, dst, opr, cross_dev, src_dev_id, dst_dev_id);
296 } else if (dst.layout.dtype.enumv() == DTypeEnum::Bool) {
297 copy_general_interior<dt_bool>(
298 src, dst, opr, cross_dev, src_dev_id, dst_dev_id);
299 } else {
300 megdnn_throw("unsupported type in reduce forward on cambricon.");
301 }
302}
303
304} // namespace
305

Callers 1

execMethod · 0.85

Calls 1

enumvMethod · 0.45

Tested by

no test coverage detected