Empty Array lead to "The strides must not allow any element to be referenced by two different indices"
評估
研究方向
Start with the dim_stride_overlap function identified in the issue and reproduce both ArrayView2::from_shape_ptr examples, including the (1, 0) shape with (0, 0) strides. Done means empty arrays with either zero dimension are accepted consistently, while non-empty overlapping strides continue to be rejected.
由索引模型根據 Issue 內容生成。
描述
I tried to create an empty array with the following command:
let shape = (1, 0).strides((0, 0));
let ptr = std::ptr::dangling::<f64>();
unsafe { ArrayView2::from_shape_ptr(shape, ptr) }
It fails with "The strides must not allow any element to be referenced by two different indices".
But the slightly different code works:
let shape = (0, 1).strides((0, 0));
let ptr = std::ptr::dangling::<f64>();
unsafe { ArrayView2::from_shape_ptr(shape, ptr) }
My expectation would be that both variants work fine.
I think the bug is inside dim_stride_overlap, which fails before the first 0 dimension is found and therefore recognises that the complete array is empty.
By the way, I use (0, 0) strides, since ndarray does the same for empty array e.g. created via zeros function.
- 主要語言
- Rust
- 星號
- 4.3k
- 分支
- 391
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
rust-ndarray/ndarray 的其他 Issue
-
.is_all_nan() returns true for an all-finite array可能已有人在做 @youdie006 於 52 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
rust-ndarray/ndarray#1612 · 1 則留言 · 1 個 reaction ·
-
難度 4/5 3-5 天 新手友好度 48/100
rust-ndarray/ndarray#1617 · 1 則留言 ·
-
Stack overflow in `triu`可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉bug good first issue
難度 3/5 1-2 天 新手友好度 68/100
rust-ndarray/ndarray#1615 · 1 則留言 ·
-
難度 4/5 3-5 天 新手友好度 48/100
rust-ndarray/ndarray#1610 ·
-
Accept owned arrays in `concatenate` and `stack`可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉breaking-change enhancement
難度 3/5 1-2 天 新手友好度 45/100
rust-ndarray/ndarray#1591 · 2 則留言 ·
查看 rust-ndarray/ndarray 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
bug llm translation
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 85/100
維護者通常 1 天內回覆
-
skillfs: one malformed chat-log line aborts the entire skill-usage analysis (skill_usage_from_chat_logs.py)可能已有人在做 @zjncs 今天認領。 未關閉component:skillfs
難度 2/5 1-3 小時 新手友好度 82/100
agentic-os-org/ANOLISA#6116 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 88/100
indygreg/cryptography-rs#99 ·