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

Method test_add

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

Source from the content-addressed store, hash-verified

183
184 @parameterized.expand(TESTS)
185 def test_add(self, device, dtype):
186 m1, t1 = self.get_im(device=device, dtype=dtype)
187 m2, t2 = self.get_im(device=device, dtype=dtype)
188 self.check(m1 + m2, t1 + t2, ids=False)
189 self.check(torch.add(m1, m2), t1 + t2, ids=False)
190 self.check(torch.add(input=m1, other=m2), t1 + t2, ids=False)
191 self.check(torch.add(m1, other=m2), t1 + t2, ids=False)
192 m3 = deepcopy(m2)
193 t3 = deepcopy(t2)
194 m3 += 3
195 t3 += 3
196 self.check(m3, t3, ids=False)
197 # check torch.Tensor+MetaTensor and MetaTensor+torch.Tensor
198 self.check(torch.add(m1, t2), t1 + t2, ids=False)
199 self.check(torch.add(t2, m1), t1 + t2, ids=False)
200
201 @parameterized.expand(TEST_DEVICES)
202 def test_conv(self, device):

Callers

nothing calls this directly

Calls 3

get_imMethod · 0.95
checkMethod · 0.95
addMethod · 0.80

Tested by

no test coverage detected