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

Function check_param_transpose

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

Source from the content-addressed store, hash-verified

21}
22
23bool check_param_transpose(
24 const TensorLayout& src, const TensorLayout& dst,
25 const std::vector<size_t>& permute) {
26 if (src.dtype != dst.dtype) {
27 return false;
28 }
29 if (src.dtype.enumv() != DTypeEnum::Uint8 && src.dtype.enumv() != DTypeEnum::Int8 &&
30 src.dtype.enumv() != DTypeEnum::Uint16 &&
31 src.dtype.enumv() != DTypeEnum::Int16 &&
32 src.dtype.enumv() != DTypeEnum::Int32 && src.dtype.enumv() != DTypeEnum::Bool &&
33 src.dtype.enumv() != DTypeEnum::Float16 &&
34 src.dtype.enumv() != DTypeEnum::Float32) {
35 return false;
36 }
37 if (src.ndim > 8 || src.ndim > CNNL_DIM_MAX || dst.ndim > CNNL_DIM_MAX ||
38 permute.size() > CNNL_DIM_MAX) {
39 return false;
40 }
41
42 // TODO: in the process of computing, the copy times of memcpy should be less than
43 // 65536.
44
45 return true;
46}
47
48bool check_tensor_for_transpose(
49 const TensorLayout& src_layout, const TensorLayout& dst_layout,

Callers 1

try_transposeFunction · 0.85

Calls 2

enumvMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected