# What is the stride information of an image referring here?

In convolutional neural networks, the convolution and pooling operations have a parameter known as stride, which decides the amount of jump the kernel needs to do on the input image. You can get more information regarding stride from follows taken from here

Stride is the number of pixels shifts over the input matrix. When the stride is 1 then we move the filters to 1 pixel at a time. When the stride is 2 then we move the filters to 2 pixels at a time and so on.

But, I am not getting what does it mean by stride information of an image at the tensor level. Consider the following paragraph from the chapter named Real-world data representation using tensors from the textbook titled Deep Learning with PyTorch by Eli Stevens et al.

img = torch.from_numpy(img_arr)
out = img.permute(2, 0, 1)


We’ve seen this previously, but note that this operation does not make a copy of the tensor data. Instead, out uses the same underlying storage as img and only plays with the size and stride information at the tensor level. This is convenient because the operation is very cheap; but just as a heads-up: changing a pixel in img will lead to a change in out.

It is mentioning about the stride information at the tensor level of an image. Do they mean the strides that are related to the CNN, pooling, etc., or are they referring to any other stride information?

Most general-purpose computer chips do not use multi-part addressing for data, such as (x,y,z), but instead use a single memory location number. To construct a data structure to represent a 2-or-more dimensional tensor means combining more fundamental representations. There are a few different ways to do this. One might be an array of arrays, where the outer array contains pointers to memory addresses of inner arrays. However, a single array with some management numbers attached to it (typically at the beginning, or even as a separate data structure, so you can have multiple tensor views of the same data) has some advantages - some operations on the array are far more efficient. Reshaping and transposing are two operations that can be implemented far more efficiently when the storage is arranged in this way.