24.04
|
Go to the documentation of this file.
45 const auto src_ptr =
static_cast<const T *
>(
src.data());
46 const auto indices_ptr =
static_cast<const uint32_t *
>(indices.
data());
47 const auto dst_ptr =
static_cast<T *
>(
dst.data());
49 const uint32_t index_limit =
src.shape()[actual_axis];
60 for(
size_t i = 0; i < indices.
shape().num_dimensions(); ++i)
62 idx_coords.
set(i, dst_coords[i + actual_axis]);
67 if(index < index_limit)
72 for(
size_t i = 0; i < actual_axis; ++i)
74 src_coords.
set(i, dst_coords[i]);
77 src_coords.
set(actual_axis, index);
79 for(
size_t i = actual_axis + 1; i <
src.shape().num_dimensions(); ++i)
81 src_coords.
set(i, dst_coords[i + indices.
shape().num_dimensions() - 1]);
86 dst_ptr[dst_addr] = src_ptr[src_addr];
90 dst_ptr[dst_addr] = 0;
SimpleTensor< float > src
void set(size_t dimension, T value, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
TensorShape shape() const override
Shape of the tensor.
void use_tensor_dimensions(const TensorShape &shape, size_t first_dimension=Window::DimX)
Use the tensor's dimensions to fill the window dimensions.
TensorShape compute_gather_shape(const TensorShape &input_shape, const TensorShape &indices_shape, uint32_t actual_axis)
Calculate the gather output shape of a tensor.
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&...iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
SimpleTensor< T > gather(const SimpleTensor< T > &src, const SimpleTensor< uint32_t > &indices, uint32_t actual_axis)
Simple tensor object that stores elements in a consecutive chunk of memory.
int coords2index(const TensorShape &shape, const Coordinates &coord)
Convert n-dimensional coordinates into a linear index.
Describe a multidimensional execution window.
Copyright (c) 2017-2024 Arm Limited.
const T * data() const
Constant pointer to the underlying buffer.