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

Method test_array_values

tests/transforms/test_copy_itemsd.py:64–70  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

62 assert_allclose(result["img_1"], torch.tensor([[1, 2], [2, 3]], device=device))
63
64 def test_array_values(self):
65 input_data = {"img": [[0, 1], [1, 2]], "seg": [[0, 1], [1, 2]]}
66 result = CopyItemsd(keys="img", times=1, names="img_1")(input_data)
67 self.assertTrue("img_1" in result)
68 result["img_1"][0][0] += 1
69 np.testing.assert_allclose(result["img"], [[0, 1], [1, 2]])
70 np.testing.assert_allclose(result["img_1"], [[1, 1], [1, 2]])
71
72 def test_graph_tensor_values(self):
73 device = torch.device("cuda:0") if torch.cuda.is_available() else torch.device("cpu:0")

Callers

nothing calls this directly

Calls 1

CopyItemsdClass · 0.90

Tested by

no test coverage detected