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

Function get_slice

tests/validation/reference/Unstack.cpp:65–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63
64template <typename T>
65SimpleTensor<T> get_slice(const SimpleTensor<T> &input_tensor, size_t axis, size_t slice)
66{
67 TensorShape out_shape = input_tensor.shape();
68 out_shape.remove_dimension(axis);
69
70 const size_t unpacked_num_dimensions(input_tensor.shape().num_dimensions());
71
72 SimpleTensor<T> output{out_shape, input_tensor.data_type()};
73
74 Window win;
75 win.use_tensor_dimensions(out_shape);
76 execute_window_loop(win,
77 [&](const Coordinates &id)
78 {
79 const Coordinates input_coords =
80 expand_coordinates(id, axis, slice, unpacked_num_dimensions);
81 *reinterpret_cast<T *>(output(id)) =
82 *reinterpret_cast<const T *>(input_tensor(input_coords));
83 });
84
85 return output;
86}
87} // namespace
88
89template <typename T>

Callers 1

unstackFunction · 0.85

Calls 5

expand_coordinatesFunction · 0.85
remove_dimensionMethod · 0.80
shapeMethod · 0.45
num_dimensionsMethod · 0.45
data_typeMethod · 0.45

Tested by

no test coverage detected