mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/33268 Test Plan: Imported from OSS Differential Revision: D19907698 Pulled By: anjali411 fbshipit-source-id: c3ce2e99fc09da91a90a8fb94e5525a00bb23703
14 lines
449 B
Python
14 lines
449 B
Python
import torch
|
|
import unittest
|
|
|
|
devices = (torch.device('cpu'), torch.device('cuda:0'))
|
|
|
|
class TestComplexTensor(unittest.TestCase):
|
|
def test_to_list_with_complex_64(self):
|
|
# test that the complex float tensor has expected values and
|
|
# there's no garbage value in the resultant list
|
|
self.assertEqual(torch.zeros((2, 2), dtype=torch.complex64).tolist(), [[0j, 0j], [0j, 0j]])
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|