MCPcopy Create free account
hub / github.com/pytorch/pytorch / test_equal

Method test_equal

test/test_namedtensor.py:244–251  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

242 self.assertEqual(output.names, expected_names)
243
244 def test_equal(self):
245 for device in get_all_device_types():
246 tensor = torch.randn(2, 3, device=device)
247 other = tensor.clone()
248
249 self.assertTrue(torch.equal(tensor.rename('N', 'C'), other.rename('N', 'C')))
250 self.assertFalse(torch.equal(tensor.rename('M', 'C'), other.rename('N', 'C')))
251 self.assertFalse(torch.equal(tensor.rename(None, 'C'), other.rename('N', 'C')))
252
253 def test_squeeze(self):
254 x = create('N:3,C:1,H:1,W:1')

Callers

nothing calls this directly

Calls 4

get_all_device_typesFunction · 0.90
randnMethod · 0.45
cloneMethod · 0.45
renameMethod · 0.45

Tested by

no test coverage detected