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

Function transpose

tests/validation/reference/Utils.cpp:96–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94 float constant_border_value);
95
96RawTensor transpose(const RawTensor &src, int chunk_width)
97{
98 // Create reference
99 TensorShape dst_shape(src.shape());
100 dst_shape.set(0, src.shape().y() * chunk_width);
101 dst_shape.set(1, std::ceil(src.shape().x() / static_cast<float>(chunk_width)));
102
103 RawTensor dst{dst_shape, src.data_type()};
104
105 // Compute reference
106 uint8_t *out_ptr = dst.data();
107
108 for (int i = 0; i < dst.num_elements(); i += chunk_width)
109 {
110 Coordinates coord = index2coord(dst.shape(), i);
111 size_t coord_x = coord.x();
112 coord.set(0, coord.y() * chunk_width);
113 coord.set(1, coord_x / chunk_width);
114
115 const int num_elements = std::min<int>(chunk_width, src.shape().x() - coord.x());
116
117 std::copy_n(static_cast<const uint8_t *>(src(coord)), num_elements * src.element_size(), out_ptr);
118
119 out_ptr += chunk_width * dst.element_size();
120 }
121
122 return dst;
123}
124
125bool valid_bilinear_policy(float xn, float yn, int width, int height, BorderMode border_mode)
126{

Callers 3

compute_targetMethod · 0.50
compute_referenceMethod · 0.50

Calls 10

ceilFunction · 0.85
index2coordFunction · 0.85
shapeMethod · 0.45
setMethod · 0.45
yMethod · 0.45
xMethod · 0.45
data_typeMethod · 0.45
dataMethod · 0.45
num_elementsMethod · 0.45
element_sizeMethod · 0.45

Tested by

no test coverage detected