KhronosGroup / OpenVX-sample-impl

OpenVX sample implementation
Apache License 2.0
139 stars 47 forks source link

Incorrect strides in vxMapTensorPatch #21

Open dvorotnev opened 4 years ago

dvorotnev commented 4 years ago

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.

daunclestone commented 4 years ago

thank you

actually I dont think it should calculate stride[] using view_end[] and view_start[]. I think it should simpl return the values in tensor->stride[] which are already initialized in ownInitTensor()