diff options
| author | Christoph Groth <christoph.groth@cea.fr> | 2025-12-02 16:31:34 +0100 |
|---|---|---|
| committer | Christoph Groth <christoph.groth@cea.fr> | 2025-12-02 16:31:34 +0100 |
| commit | 33938712af1b7191cf18c8a06f214b61dc279d02 (patch) | |
| tree | c52dc481259266fbcf1693c0c5d4079f955cd45e | |
| parent | c087e1860fc1ec8faf65bc5a9af86733066577cf (diff) | |
Shorten arange-like code
| -rw-r--r-- | src/main.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index be0571d..bba61f1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -42,8 +42,7 @@ fn main() { assert_eq!(c.permute([1, 0]), c.transpose()); // Arrays with rank > 6: - let d: Vec<f64> = (0..128).map(|x| x as f64).collect(); - let d: md::DTensor<f64, 1> = d.into(); + let d: md::DTensor<f64, 1> = (0..128).map(f64::from).collect::<Vec<_>>().into(); let d = d.into_dyn(); let d = d.reshape(&[2; 7]); let d = d.permute(&[6, 5, 4, 3, 2, 1, 0]); |
