MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / test_stack

Method test_stack

tests/data/meta_tensor/test_meta_tensor.py:210–218  ·  view source on GitHub ↗
(self, device, dtype)

Source from the content-addressed store, hash-verified

208
209 @parameterized.expand(TESTS)
210 def test_stack(self, device, dtype):
211 numel = 3
212 ims = [self.get_im(device=device, dtype=dtype)[0] for _ in range(numel)]
213 stacked = torch.stack(ims)
214 self.assertIsInstance(stacked, MetaTensor)
215 orig_affine = ims[0].meta.pop("affine")
216 stacked_affine = stacked.meta.pop("affine")
217 assert_allclose(orig_affine, stacked_affine)
218 self.assertEqual(stacked.meta, ims[0].meta)
219
220 def test_get_set_meta_fns(self):
221 set_track_meta(False)

Callers

nothing calls this directly

Calls 3

get_imMethod · 0.95
assert_allcloseFunction · 0.90
popMethod · 0.80

Tested by

no test coverage detected