Questions tagged [stride]
The stride of an array is the number of locations in memory between beginnings of successive array elements, measured in bytes or in units of the size of the array's elements. Arrays may have a stride larger than their elements' width in bytes, which are called a non-unit stride. One particular use of non-unit stride is for images, when creating subimages without copying the pixel data.
stride
161
questions
1
vote
3
answers
58
views
Equivalence between reshape, strides and transpose? (numpy)
i am sorry for the very naive question.
I have these lines of numpy code, with a transpose at the beginning, and strides and reshape are used afterward.
I wonder if by re-ordering indices in reshape ...
0
votes
0
answers
18
views
What is the opposite of stride?
Suppose I have a 5-dimensional array of the following shape: (2, 3, 4, 5, 6)
For arrays with row-major layout the stride for the 3rd dimension is then equal to 5x6.
For the 4th dimension the stride is ...
1
vote
0
answers
19
views
Kotlin - how can I create a list of numbers between a range and stepped by a certain value [duplicate]
In Kotlin, I'm trying to create a val with a list of numbers within a specific range, incremented by 1.5. How can I do this? I've tried the below, but I'm getting an error with "step".
val ...
2
votes
1
answer
121
views
What stride should I use for matrices in CUDA for the fastest possible speed?
I'm working with matrices that range in size from 2,000x2,000 up to 5,000x5,000, doing operations such as multiplication and QR decomposition. I'm curious if, for example, I should align the stride by ...
2
votes
1
answer
350
views
Does PyTorch support stride_tricks as in numpy.lib.stride_tricks.as_strided?
It is possible to make cool things by changing the strides of an array in Numpy like this:
import numpy as np
from numpy.lib.stride_tricks import as_strided
a = np.arange(15).reshape(3,5)
print(a)
# ...
3
votes
3
answers
115
views
How strided memcpy(3) works in libvpx
I'm trying to understand the following function in libvpx (vp8/common/reconinter.c):
void vp8_copy_mem16x16_c(unsigned char *src, int src_stride, unsigned char *dst,
int ...
0
votes
0
answers
189
views
Why are sizes and strides of SIMD3<Float> and SCNVector different?
So when I was working with buffers I was having something like UnsafeRawPointer (which consisted of SCNVector3) and I was casting it to UnsafeBufferPointer<SIMD3<Float>>. And then I saw ...
0
votes
2
answers
154
views
How to use cupy.lib.stride_tricks.as_strided(x, shape=None, strides=None)
I was using:
np.lib.stride_tricks.sliding_window_view
with a 1D-array and two parameters (the array and the length of the subset n) to slice it into slices of n elements (n < 1D-array.shape, of ...
2
votes
1
answer
2k
views
SwiftUI - Attempted to scroll the collection view to an out-of-bounds item
My App is getting crashed immediately after navigating to the screen in iOS>16.0 devices by saying
*** Assertion failure in -[_TtC7SwiftUIP33_8825076C2763A50452A210CBE1FA4AF020PagingCollectionView ...
2
votes
2
answers
144
views
Identify a minimum that occurs before a maximum within a rolling widow in python
I am trying to identify a minimum that occurs before a maximum that is found within a rolling window that starts on row after (yes that is convoluted but I don’t have the English to express it ...
3
votes
1
answer
2k
views
What is stride in c
What is 'stride' in C and how can it be used?
0
votes
1
answer
704
views
Python (32-bit) librosa error: ValueError: array is too big; `arr.size * arr.dtype.itemsize` is larger than the maximum possible size
I am trying to use librosa to extract audio features. I use a Raspberry Pi 4 running 32-bit RaspiOS running Python 3.8.7.
When I try to run the code:
import librosa
import numpy as np
soundddata, fs = ...
0
votes
0
answers
363
views
How to set right strides in MLMultiArray in Core ML? What's the strides' values' meaning?
How to set right strides in MLMultiArray in Core ML? What's the EVERY strides' values' meaning?
For example, assume a Core ML model input shape is (1, 3, 1280, 720), so how to set strides when create ...
0
votes
1
answer
527
views
NumPy 'as_strided' for strided sliding window over RGBA image (3D array)
I've done research and looked over several questions on SO to figure out the proper set-up of strides and shape, but it's been giving me problems.
I have an image array of shape (250, 250, 4) (example)...
2
votes
1
answer
1k
views
python implementation of numpy.lib.stride_tricks.as_strided
I'm trying to translate the as_strided function of NumPy to a function in Python when I translate ahead the number of strides to the number of variables according to the type of the variable (for ...