@@ -36,7 +36,7 @@ TEST_CASE("Testing Shape", "[Shape]")
36
36
CHECK (s != n);
37
37
}
38
38
39
- SECTION (" Shape comutation " ) {
39
+ SECTION (" Shape computation " ) {
40
40
Shape stride = shapeToStride (s);
41
41
CHECK (stride.size () == s.size ());
42
42
CHECK (stride == Shape ({5 ,1 }));
@@ -109,7 +109,7 @@ TEST_CASE("Testing Tensor", "[Tensor]")
109
109
CHECK (q.dtype () == t.dtype ());
110
110
CHECK (q.shape () == t.shape ());
111
111
CHECK (q.backend () == t.backend ());
112
- CHECK (q.shape ( ) == zeros_like (t). shape ()); // Lazy way to check if zeros_like works too
112
+ CHECK (q.isSame (t ) == true );
113
113
}
114
114
115
115
SECTION (" Tesnor basic" ) {
@@ -245,12 +245,12 @@ TEST_CASE("Testing Tensor", "[Tensor]")
245
245
CHECK (t[r].isSame (t.view (r)));
246
246
}
247
247
248
- SECTION (" assign to subscription" ) {
248
+ SECTION (" assign to subscription (scalar) " ) {
249
249
t[{2 , 2 }] = t[{2 , 2 }] + 1 ;
250
250
CHECK (t[{2 , 2 }].item <int >() == 11 );
251
251
}
252
252
253
- SECTION (" self increment and assign " ) {
253
+ SECTION (" assign to subscription (vector) " ) {
254
254
t[{2 }] = t[{2 }] + 1 ;
255
255
// Check a subset of weather the result is correct
256
256
CHECK (t[{2 , 2 }].item <int >() == 11 );
@@ -260,9 +260,11 @@ TEST_CASE("Testing Tensor", "[Tensor]")
260
260
SECTION (" item" ) {
261
261
Tensor t = ones ({1 });
262
262
CHECK (t.item <int >() == 1 );
263
+ // item() should fail because asking for the wrong type
263
264
CHECK_THROWS (t.item <float >());
264
265
265
266
Tensor q = ones ({2 });
267
+ // item() should fail because q is not a scalar
266
268
CHECK_THROWS (q.item <int >());
267
269
}
268
270
}
0 commit comments