Strides क्या हैं
Strides NumPy को बताते हैं हर axis के साथ अगले element तक move करने के लिए कितने bytes jump करने हैं।
In this page:
Syntax
arr.strides
Strides
Strides वह तरीका है जिससे NumPy एक multi-dimensional index को flat memory पर map करता है। एक C-ordered (3, 4) int64 array की strides (32, 8) हैं। Transposing data move किए बिना बस strides swap करता है, यही वजह है यह instant है।
Note:
np.lib.stride_tricks.as_strided sliding windows बना सकता है लेकिन गलत इस्तेमाल होने पर invalid memory पढ़ सकता है।
उदाहरण: Strides
import numpy as np
a = np.arange(12, dtype=np.int64).reshape(3, 4)
print(a.strides)
print(a.T.strides)
print(a.T.flags["C_CONTIGUOUS"])
# Output:
# (32, 8)
# (8, 32)
# False
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the
view already swaps in the hi_ translation fields (or blanks these
out if untranslated), so this renders correctly for both languages
without a lang_code check here. #}
आम गलतियां
- bytes में strides को element counts से confuse करना
- बिना care के as_strided इस्तेमाल करना
- यह मान लेना कि एक transpose data copy करता है
चैप्टर सारांश
- strides प्रति axis byte steps हैं
- Transpose strides swap करता है
- कोई data move नहीं होता
- as_strided powerful लेकिन risky है
🔒
Chapter Quiz — Complete all 7 topics to unlock
0/7 topics done
Complete these topics first: