32 namespace tensor_transform
36 return index >=
static_cast<int>(strides.
num_dimensions()) ? 1 : strides[index];
51 int start = starts[index];
60 const int dim_size = input_shape[index];
74 int32_t end_mask, int32_t shrink_axis_mask)
79 return input_shape[index];
86 int stop = ends[index];
91 if(start_on_index == std::numeric_limits<int>::max())
93 stop = start_on_index;
97 stop = start_on_index + 1;
108 const int dim_size = input_shape[index];
122 int32_t begin_mask, int32_t end_mask, int32_t shrink_axis_mask)
131 starts_abs.set(i, start_i);
132 ends_abs.set(i,
calculate_end_on_index(input_shape, i, start_i, ends, strides, end_mask, shrink_axis_mask));
136 return std::make_tuple(starts_abs, ends_abs, final_strides);
140 int32_t begin_mask, int32_t end_mask, int32_t shrink_axis_mask,
bool return_unshrinked)
142 unsigned int index = 0;
153 if(return_unshrinked || !is_shrink)
156 (range < 0 && stride >= 0) ||
157 (range > 0 && stride <= 0))
159 output_shape.
set(index, 0);
164 int dim = range / stride + (range % stride != 0 ? 1 : 0);
165 output_shape.
set(index++, dim);
175 int32_t end_mask = 0;
bool is_bit_set(T v, unsigned int idx)
Checks if the idx-th bit is set in an integral type.
Copyright (c) 2017-2021 Arm Limited.
DataType clamp(const DataType &n, const DataType &lower=std::numeric_limits< RangeType >::lowest(), const DataType &upper=std::numeric_limits< RangeType >::max())
Performs clamping among a lower and upper value.
TensorShape input_shape
Validate test suite is to test ARM_COMPUTE_RETURN_ON_* macros we use to check the validity of given a...
SimpleTensor< T > range(SimpleTensor< T > &dst, float start, const size_t num_of_elements, float step)
void end(TokenStream &in, bool &valid)
unsigned int num_dimensions() const
Returns the effective dimensionality of the tensor.
TensorShape & set(size_t dimension, size_t value, bool apply_dim_correction=true, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.