| 21 | } |
| 22 | |
| 23 | bool 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 | |
| 48 | bool check_tensor_for_transpose( |
| 49 | const TensorLayout& src_layout, const TensorLayout& dst_layout, |
no test coverage detected