MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / permute

Function permute

tests/validation/reference/Permute.cpp:39–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37{
38template <typename T>
39SimpleTensor<T> permute(const SimpleTensor<T> &src, PermutationVector perm)
40{
41 // Permute shapes
42 TensorShape dst_shape = src.shape();
43 permute(dst_shape, perm);
44
45 // Create reference
46 SimpleTensor<T> dst{dst_shape, src.data_type(), src.num_channels(), src.quantization_info()};
47
48 // Compute reference
49 const uint32_t num_elements = src.num_elements();
50 for (uint32_t i = 0; i < num_elements; ++i)
51 {
52 const Coordinates src_coords = index2coord(src.shape(), i);
53 Coordinates dst_coords = src_coords;
54 permute(dst_coords, perm);
55
56 std::copy_n(static_cast<const T *>(src(src_coords)), src.num_channels(), static_cast<T *>(dst(dst_coords)));
57 }
58
59 return dst;
60}
61
62template SimpleTensor<int8_t> permute(const SimpleTensor<int8_t> &src, PermutationVector perm);
63template SimpleTensor<uint8_t> permute(const SimpleTensor<uint8_t> &src, PermutationVector perm);

Callers 15

rdft_2dFunction · 0.70
ridft_2dFunction · 0.70
dft_2dFunction · 0.70
pooling_layer_internalFunction · 0.70
fill_with_generatorMethod · 0.50
setupMethod · 0.50
validateFunction · 0.50
validate_wrapFunction · 0.50
compute_targetMethod · 0.50

Calls 6

index2coordFunction · 0.85
shapeMethod · 0.45
data_typeMethod · 0.45
num_channelsMethod · 0.45
quantization_infoMethod · 0.45
num_elementsMethod · 0.45

Tested by

no test coverage detected