I have a newbie question about tensor stride calculation. I am having problem using the stride values returned by vxMapTensorPatch()
.
I see that in ownInitTensor()
the stride values are calculated as
tensor->stride[i] = tensor->stride[i - 1] * tensor->dimensions[i - 1];
but in vxMapTensorPatch()
the stride values are calculated as
stride[i] = stride[i - 1] * (view_end[i] - view_start[i]);
this causes the stride values returned by vxMapTensorPatch()
to be different from that in tensor->stride[]. Why is the calculation in vxMapTensorPatch()
not as follows
stride[i] = stride[i - 1] * (view_end[i-1] - view_start[i-1]);
Shouldn’t the stride calculation be the same in both places?
thx
dvorotnev (Dmity Vorotnev) · GitHub also spotted this issue and fixed it. see link below.
opened 01:23PM - 19 May 20 UTC
bug
Hello! In the function `vxMapTensorPatch` from OpenVX v1.3 calculations for the … strides seem incorrect.
For example, for a tensor with data type `VX_TYPE_INT16` `dimensions = {3, 1, 2, 2}` and the function params `view_start = {0, 0, 0, 0}`, `view_end = {3, 1, 2, 2}` it calculates `strides = {2, 2, 4, 8}`:
```
for (vx_uint32 i = 1; i < number_of_dims; i++)
{
stride[i] = stride[i - 1] * (view_end[i] - view_start[i]);
}
```
I think that the strides should be calculated as:
```
for (vx_uint32 i = 1; i < number_of_dims; i++)
{
stride[i] = stride[i - 1] * (view_end[i - 1] - view_start[i - 1]);
}
```
and there are `strides = {2, 6, 6, 12}` for the given example.
system
Closed
December 24, 2020, 7:52pm
3
This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.