()
| 728 | |
| 729 | #[test] |
| 730 | fn non_macro_seq_array_index() { |
| 731 | set_device(0); |
| 732 | // ANCHOR: non_macro_seq_array_index |
| 733 | let values: [f32; 3] = [1.0, 2.0, 3.0]; |
| 734 | let indices = Array::new(&values, Dim4::new(&[3, 1, 1, 1])); |
| 735 | let seq4gen = Seq::new(0.0, 2.0, 1.0); |
| 736 | let a = randu::<f32>(Dim4::new(&[5, 3, 1, 1])); |
| 737 | // [5 3 1 1] |
| 738 | // 0.0000 0.2190 0.3835 |
| 739 | // 0.1315 0.0470 0.5194 |
| 740 | // 0.7556 0.6789 0.8310 |
| 741 | // 0.4587 0.6793 0.0346 |
| 742 | // 0.5328 0.9347 0.0535 |
| 743 | |
| 744 | let mut idxrs = Indexer::default(); |
| 745 | idxrs.set_index(&indices, 0, None); // 2nd arg is indexing dimension |
| 746 | idxrs.set_index(&seq4gen, 1, Some(false)); // 3rd arg indicates batch operation |
| 747 | |
| 748 | let _sub2 = index_gen(&a, idxrs); |
| 749 | //println!("a(indices, seq(0, 2, 1))"); print(&sub2); |
| 750 | // [3 3 1 1] |
| 751 | // 0.1315 0.0470 0.5194 |
| 752 | // 0.7556 0.6789 0.8310 |
| 753 | // 0.4587 0.6793 0.0346 |
| 754 | // ANCHOR_END: non_macro_seq_array_index |
| 755 | } |
| 756 | |
| 757 | #[test] |
| 758 | fn seq_array_index() { |
nothing calls this directly
no test coverage detected