Skip to content
heliaCORE
API reference
HELIA HUB

Slicing Functions:

Machine-readable model

function

Strided slice for float32 data (pure copy, TensorFlow Lite compatible).

Include/arm_nnfunctions_flt.h:1373

arm_cmsis_nn_status arm_strided_slice_f32(
const float32_t *input_data,
float32_t *output_data,
const cmsis_nn_dims *const input_dims,
const cmsis_nn_dims *const begin_dims,
const cmsis_nn_dims *const stride_dims,
const cmsis_nn_dims *const output_dims
)

Strided slice for float32 data (pure copy, TensorFlow Lite compatible).

Reads element i of input axis a at begin_dims[a] + i * stride_dims[a], for i from 0 to output_dims[a] - 1, and writes the elements contiguously in N, H, W, C order: output_dims->n * h * w * c elements in all. Every argument is per input axis, in input axis order [N, H, W, C], after the caller pads a lower-rank slice to 4-D.

output_dims holds the number of elements to read on each input axis. That is the output tensor’s shape only when no axis is removed: for an axis that TFLite’s shrink_axis_mask removes, or any slice whose output rank is below the input rank, pass 1 at that axis’s position, not the output tensor’s shape padded to 4-D. TFLM’s strided_slice::StridedSliceStartForAxis() and StridedSliceEndForAxis() give the per-axis begin and end the counts follow from. Example: input [2, 3, 4] sliced x[:, 1, :] (shrink axis 1) is input_dims {1, 2, 3, 4}, begin_dims {0, 0, 1, 0}, stride_dims {1, 1, 1, 1} and output_dims {1, 2, 1, 4}; the output tensor’s padded shape {1, 1, 2, 4} would read rows 1 and 2 of batch 0 instead, and still return ARM_CMSIS_NN_SUCCESS.

Every visited index must lie inside input_dims, and the output buffer must hold the elements read; neither is checked. An empty slice (a count of 0 on some axis) is rejected, so the caller skips it before the call.

Parameters of arm_strided_slice_f32
NameTypeDirectionDescription
input_dataconst float32_t *inPointer to input tensor.
output_datafloat32_t *outPointer to output tensor.
input_dimsconst cmsis_nn_dims *constinInput tensor dimensions, each at least 1.
begin_dimsconst cmsis_nn_dims *constinIndex of the first element read on each input axis.
stride_dimsconst cmsis_nn_dims *constinStep between elements read on each input axis, nonzero; negative walks backwards.
output_dimsconst cmsis_nn_dims *constinNumber of elements to read on each input axis, each at least 1 (see above).
Returns of arm_strided_slice_f32
Description
ARM_CMSIS_NN_SUCCESS, or ARM_CMSIS_NN_ARG_ERROR when a pointer is NULL, an input_dims or output_dims value is less than 1, or a stride_dims value is 0.