Skip to content

Commit 4b1df53

Browse files
committed
Add another test for 1 -> n broadcast (1d)
1 parent 8ecbbd3 commit 4b1df53

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/broadcast.rs

+14
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,17 @@ fn test_broadcast() {
6969
assert_eq!(b0, b1);
7070
assert_eq!(b0, b2);
7171
}
72+
73+
#[test]
74+
fn test_broadcast_1d() {
75+
let n = 16;
76+
let x1 = 1.;
77+
// b0 broadcast 1 -> n
78+
let x = Array::from_vec(vec![x1]);
79+
let b0 = x.broadcast(n).unwrap();
80+
let b2 = Array::from_elem(n, x1);
81+
82+
println!("b0=\n{:?}", b0);
83+
println!("b2=\n{:?}", b2);
84+
assert_eq!(b0, b2);
85+
}

0 commit comments

Comments
 (0)