Accept owned arrays in `concatenate` and `stack`
評估
研究方向
Start by reading the current concatenate and stack entry points and their signatures. Check how they accept views, how owned arrays would fit, and what happens for an empty slice. Done means the proposed API works for owned arrays and views without leaving the documented inference concern unresolved.
由索引模型根據 Issue 內容生成。
描述
It would be convenient to be able to call concatenate or stack with a slice of owned arrays or array views, rather than just views currently.
So for concatenate, this:
let arrays = vec![a, b, c]; // more realistically, this would be returned by a function
let arrays = arrays.iter().map(|a| a.view()).collect::<Vec<_>>();
let res = ndarray::concatenate(Axis(2), &arrays);
would become:
let arrays = vec![a, b, c];
let res = ndarray::concatenate(Axis(2), &arrays);
This could be done by changing the signature of concatenate to the following, which would allow either views or owned arrays:
-pub fn concatenate<A, D>(axis: Axis, arrays: &[ArrayView<A, D>]) -> Result<Array<A, D>, ShapeError>
+pub fn concatenate<S, D, A>(axis: Axis, arrays: &[ArrayBase<S, D, A>]) -> Result<Array<A, D>, ShapeError>
where
+ S: Data<Elem = A>,
A: Clone,
D: RemoveAxis,
{
This is technically a breaking API change though, at least in the niche case of passing an empty slice as a parameter (which causes a type inference error). Before I open an unsolicited PR, would there be interest in this change?
- 主要語言
- 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 ·
-
Empty Array lead to "The strides must not allow any element to be referenced by two different indices"可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 3/5 1-2 天 新手友好度 72/100
rust-ndarray/ndarray#1609 ·
查看 rust-ndarray/ndarray 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 85/100
維護者通常 1 天內回覆
-
install: root SSH tmpfiles.d drop-in is labeled etc_runtime_t instead of etc_t可能已有人在做 @andrewdunndev 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
[Misdetection] `text/tab-separated-values` file misdetected as `text/tsv`可能已有人在做 @bact 今天認領。 未關閉misdetection needs triage
難度 2/5 1-3 小時 新手友好度 70/100
維護者通常 1 天內回覆
-
C-bug
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 2 天內回覆
-
vxc prints a debug line '[flat-codegen] emitted module via the flat path' on every compile可能已有人在做 @YodHeVauHe 今天認領。 未關閉devex good first issue
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆