- func: resize_as_(Tensor(a!) self, Tensor the_template) -> Tensor(a!)
matches_jit_signature: True
+ cpu_bool: True
+ cuda_bool: True
+ cpu_half: True
variants: function, method
dispatch:
CPU: resize_as_
variants: function, method
- func: view(Tensor(a) self, int[] size) -> Tensor(a)
+ cpu_half: True
+ cpu_bool: True
+ cuda_bool: True
matches_jit_signature: True
variants: method
device_guard: False
x.resize_(shape)
self.assertEqual(shape, x.shape)
+ def test_resize_as_all_dtypes_and_devices(self):
+ for device in torch.testing.get_all_device_types():
+ for dt in torch.testing.get_all_dtypes():
+ x = torch.tensor([[1, 2], [3, 4], [5, 6]], dtype=dt, device=device)
+ y = torch.tensor([[1, 2, 3], [4, 5, 6]], dtype=dt, device=device)
+ x.resize_as_(y)
+ self.assertEqual(y.shape, x.shape)
+
+ def test_view_all_dtypes_and_devices(self):
+ for device in torch.testing.get_all_device_types():
+ for dt in torch.testing.get_all_dtypes():
+ x = torch.tensor([[1, 2], [3, 4], [5, 6]], dtype=dt, device=device)
+ self.assertEqual(x.view(6).shape, [6])
+
def test_fill_all_dtypes_and_devices(self):
for device in torch.testing.get_all_device_types():
for dt in torch.testing.get_all_dtypes():