Commit 005adfd2 authored by Geoffrey Roeder's avatar Geoffrey Roeder Committed by Alykhan Tejani
Browse files

Expands coverage in test_to_tensor to 1 and 4 image channels (#296)

expands coverage on test_to_tensor to 1 and 4 image channels
parent 9834c99c
...@@ -248,9 +248,11 @@ class Tester(unittest.TestCase): ...@@ -248,9 +248,11 @@ class Tester(unittest.TestCase):
assert (y.equal(x)) assert (y.equal(x))
def test_to_tensor(self): def test_to_tensor(self):
channels = 3 test_channels = [1, 3, 4]
height, width = 4, 4 height, width = 4, 4
trans = transforms.ToTensor() trans = transforms.ToTensor()
for channels in test_channels:
input_data = torch.ByteTensor(channels, height, width).random_(0, 255).float().div_(255) input_data = torch.ByteTensor(channels, height, width).random_(0, 255).float().div_(255)
img = transforms.ToPILImage()(input_data) img = transforms.ToPILImage()(input_data)
output = trans(img) output = trans(img)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment