@@ -13,9 +13,10 @@ getting information from data structures and performing various operations on th
1313 - :ref: `get_shift_val `
1414
1515 - :ref: `get_zero_offset_val `
16-
17- - :ref: `point_sub_tensor `
18-
16+
17+ ..
18+ - :ref:`point_sub_tensor`
19+
1920 - :ref: `num_of_accu_bits `
2021
2122
@@ -146,8 +147,8 @@ Get Scale Shift Value
146147~~~~~~~~~~~~~~~~~~~~~
147148
148149This function returns the shift value from the quantization parameters.
149- For data formats that don’ t have a shift value, the value 0 is returned.
150- For tensors with multiple scale values per-axis, the parameter``scale_idx``
150+ For data formats that don' t have a shift value, the value 0 is returned.
151+ For tensors with multiple scale values per-axis, the parameter ``scale_idx ``
151152defines the particular scale shift value to be fetched.
152153
153154Function prototype
@@ -223,79 +224,86 @@ Conditions:
223224 - zero_idx must be less or equal to number of zero offset values in the tensor
224225
225226.. _point_sub_tensor :
226-
227- Point to Sub-Tensor
228- ~~~~~~~~~~~~~~~~~~~
229-
230- This function points to sub tensors in the input tensor. This function can
231- be considered as indexing in a multidimensional array without copying or
232- used to create a slice/fragment of the input tensor without copying the data.
233227
234- For example, given a HWC tensor, this function could be used to create a HWC
235- tensor for the top half of the HW image for all channels.
236-
237- The configuration struct is defined as follows and the fields are explained in
238- Table :ref: `t_mli_sub_tensor_cfg_desc `.
239-
240- .. code :: c
241-
242- typedef struct {
243- uint32_t offset[MLI_MAX_RANK];
244- uint32_t size[MLI_MAX_RANK];
245- uint32_t sub_tensor_rank;
246- } mli_sub_tensor_cfg;
247228..
248-
249- .. _t_mli_sub_tensor_cfg_desc :
250- .. table :: mli_sub_tensor_cfg Structure Field Description
251- :align: center
252- :widths: auto
229+ Point to Sub-Tensor
230+ ~~~~~~~~~~~~~~~~~~~
231+
232+ .. warning ::
233+
234+ The interface of this function is subject to change. Avoid using it.
235+
236+ ..
237+
238+ This function points to sub tensors in the input tensor. This function can
239+ be considered as indexing in a multidimensional array without copying or
240+ used to create a slice/fragment of the input tensor without copying the data.
241+
242+ For example, given a HWC tensor, this function could be used to create a HWC
243+ tensor for the top half of the HW image for all channels.
244+
245+ The configuration struct is defined as follows and the fields are explained in
246+ Table :ref: `t_mli_sub_tensor_cfg_desc `.
247+
248+ .. code :: c
249+
250+ typedef struct {
251+ uint32_t offset[MLI_MAX_RANK];
252+ uint32_t size[MLI_MAX_RANK];
253+ uint32_t sub_tensor_rank;
254+ } mli_sub_tensor_cfg;
255+ ..
256+
257+ .. _t_mli_sub_tensor_cfg_desc :
258+ .. table :: mli_sub_tensor_cfg Structure Field Description
259+ :align: center
260+ :widths: auto
261+
262+ +---------------------+----------------+---------------------------------------------------------+
263+ | **Field Name ** | **Type ** | Description |
264+ +=====================+================+=========================================================+
265+ | | | Start coordinate in the input tensor. Values must |
266+ | ``offset `` | ``uint32_t[] `` | be smaller than the shape of the input tensor. Size |
267+ | | | of the array must be equal to the rank of the input |
268+ | | | tensor. |
269+ +---------------------+----------------+---------------------------------------------------------+
270+ | | | Size of the sub tensor in elements per dimension: |
271+ | ``size `` | ``uint32_t[] `` | |
272+ | | | Restrictions: Size[d] + offset[d] <= input->shape[d] |
273+ +---------------------+----------------+---------------------------------------------------------+
274+ | | | Rank of the sub tensor that is produced. Must be |
275+ | | | smaller or equal to the rank of the input tensor. If |
276+ | ``sub_tensor_rank `` | ``uint32_t `` | the ``sub_tensor_rank `` is smaller than the input rank, |
277+ | | | the dimensions with a size of 1 is removed in the |
278+ | | | output shape starting from the first dimension until |
279+ | | | the requested ``sub_tensor_rank `` value is reached. |
280+ +---------------------+----------------+---------------------------------------------------------+
281+ ..
282+
283+ This function computes the new data pointer based on the offset vector and it sets
284+ the shape of the output tensor according to the size vector. The ``mem_stride `` fields
285+ are copied from the input to the output, so after this operation, the output tensor might
286+ not be a contiguous block of data.
287+
288+ The function also reduces the rank of the output tensor if requested by the
289+ configuration. Only the dimensions with a size of 1 can be removed. Data format and
290+ quantization parameters are copied from the input to the output tensor.
291+
292+ The capacity field of the output is the input capacity decremented with the same
293+ value as that used to increment the data pointer.
294+
295+ The function prototype:
296+
297+ .. code :: c
298+
299+ mli_status mli_hlp_subtensor(
300+ const mli_tensor *in,
301+ const mli_subtensor_cfg *cfg,
302+ mli_tensor *out);
303+ ..
253304
254- +---------------------+----------------+---------------------------------------------------------+
255- | **Field Name ** | **Type ** | Description |
256- +=====================+================+=========================================================+
257- | | | Start coordinate in the input tensor. Values must |
258- | ``offset `` | ``uint32_t[] `` | be smaller than the shape of the input tensor. Size |
259- | | | of the array must be equal to the rank of the input |
260- | | | tensor. |
261- +---------------------+----------------+---------------------------------------------------------+
262- | | | Size of the sub tensor in elements per dimension: |
263- | ``size `` | ``uint32_t[] `` | |
264- | | | Restrictions: Size[d] + offset[d] <= input->shape[d] |
265- +---------------------+----------------+---------------------------------------------------------+
266- | | | Rank of the sub tensor that is produced. Must be |
267- | | | smaller or equal to the rank of the input tensor. If |
268- | ``sub_tensor_rank `` | ``uint32_t `` | the ``sub_tensor_rank `` is smaller than the input rank, |
269- | | | the dimensions with a size of 1 is removed in the |
270- | | | output shape starting from the first dimension until |
271- | | | the requested ``sub_tensor_rank `` value is reached. |
272- +---------------------+----------------+---------------------------------------------------------+
273- ..
274-
275- This function computes the new data pointer based on the offset vector and it sets
276- the shape of the output tensor according to the size vector. The ``mem_stride `` fields
277- are copied from the input to the output, so after this operation, the output tensor might
278- not be a contiguous block of data.
279-
280- The function also reduces the rank of the output tensor if requested by the
281- configuration. Only the dimensions with a size of 1 can be removed. Data format and
282- quantization parameters are copied from the input to the output tensor.
283-
284- The capacity field of the output is the input capacity decremented with the same
285- value as that used to increment the data pointer.
286-
287- The function prototype:
288-
289- .. code :: c
290-
291- mli_status mli_hlp_subtensor(
292- const mli_tensor *in,
293- const mli_subtensor_cfg *cfg,
294- mli_tensor *out);
295- ..
296-
297- Depending on the debug level (see section :ref: `err_codes `), this function performs a parameter
298- check and returns the result as an ``mli_status `` code as described in section :ref: `kernl_sp_conf `.
305+ Depending on the debug level (see section :ref: `err_codes `), this function performs a parameter
306+ check and returns the result as an ``mli_status `` code as described in section :ref: `kernl_sp_conf `.
299307
300308
301309.. _num_of_accu_bits :
0 commit comments