37 inline unsigned int wrap_axis(
int axis,
const ITensorInfo *
const tensor)
39 return wrap_around(axis, static_cast<int>(tensor->num_dimensions()));
42 inline void setup_slice_coordinates_and_mask(Coordinates &slice_start, int32_t &slice_end_mask,
const unsigned int input_num_dimensions)
45 Coordinates slice_end;
46 slice_start.set_num_dimensions(input_num_dimensions);
47 slice_end.set_num_dimensions(input_num_dimensions);
48 for(
size_t k = 0;
k < input_num_dimensions; ++
k)
50 slice_start.set(
k, 0);
59 _strided_slice_vector()
65 std::vector<ITensorInfo *> outputs_vector_info(output_vector.size());
66 std::transform(output_vector.begin(), output_vector.end(), outputs_vector_info.begin(), [](
ITensor *
t)
77 const unsigned int axis_u = wrap_axis(axis, input->
info());
78 _num_slices = std::min(outputs_vector_info.size(), input->
info()->
dimension(axis_u));
79 _strided_slice_vector.resize(_num_slices);
82 int32_t slice_end_mask;
99 const unsigned int num_slices = std::min(output_vector.size(), input->
dimension(wrap_axis(axis, input)));
104 int32_t slice_end_mask;
105 for(
size_t k = 0;
k < num_slices; ++
k)
107 slice_start.
set(wrap_axis(axis, input),
k);
116 for(
unsigned i = 0; i < _num_slices; ++i)
118 _strided_slice_vector[i].run();
void set(size_t dimension, T value, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
Coordinates BiStrides
Bidirectional strides.
Store the tensor's metadata.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
Interface for CPU tensor.
Copyright (c) 2017-2023 Arm Limited.
static Status validate(const ITensorInfo *input, const ITensorInfo *output, const Coordinates &starts, const Coordinates &ends, const BiStrides &strides, int32_t begin_mask=0, int32_t end_mask=0, int32_t shrink_axis_mask=0)
Static function to check if given info will lead to a valid configuration of NEStridedSlice.
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
T wrap_around(T x, T m)
Wrap-around a number within the range 0 <= x < m.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
void configure(const ITensor *input, const std::vector< ITensor *> &output_vector, int axis)
Set the input, output and unstacking axis.
virtual ITensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
void run() override
Run the kernels contained in the function.
unsigned int num_dimensions() const
Returns the effective dimensionality of the tensor.
CLTensor * tensor
Pointer to the auxiliary tensor.
#define ARM_COMPUTE_LOG_PARAMS(...)
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
static Status validate(const ITensorInfo *input, const std::vector< ITensorInfo *> &output_vector, int axis)
Static function to check if given info will lead to a valid configuration of NEUnstack.
SimpleTensor< T > slice(const SimpleTensor< T > &src, Coordinates starts, Coordinates ends)
NEUnstack()
Default constructor.