Currently, the input aclTensors of most operator APIs support non-contiguous tensors. That is, a tensor can be represented by (shape, strides, offset).
Note: You can create an aclTensor by referring to "Common APIs" > "aclCreateTensor" in the .
For a tensor with shape=(6, 5), strides=(10, 1), and offset=22, its memory layout is as follows:
[object Object]
The boldfaced values represent the memory layout of the tensor. The complete tensor is discontiguous in memory layout. strides indicates the interval between two adjacent elements on a tensor dimension. If the stride on dimension 1 is 1, the dimension is contiguous. If the stride on dimension 0 is 10, adjacent elements are separated by 10 elements, that is, they are discontiguous elements. offset indicates the offset of the first element of the tensor relative to the address.
For a tensor with shape=(4, 3), strides=(20, 2), and offset=22, its memory layout is as follows:
[object Object]
The boldfaced values represent the memory layout of the tensor. The whole tensor is not contiguous in memory. strides indicates the interval between two adjacent elements on a tensor dimension. If the stride on dimension 1 is 2, there is an interval of 1 element on this dimension. If the stride on dimension 0 is 20, adjacent elements are separated by 20 elements, that is, they are discontiguous elements. offset indicates the offset of the first element of the tensor relative to the address.