Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_rgb_to_grayscale(self):
channels, height, width = 3, 4, 5
img = torch.ones(channels, height, width)
assert taug.Grayscale()(img).shape == (1, height, width)
def test_smoke_batch(self):
batch_size, height, width, channels = 2, 4, 5, 3
img = np.ones((batch_size, height, width, channels))
transforms = nn.Sequential(
taug.ToTensor(),
taug.Grayscale(),
)
assert transforms(img).shape == (batch_size, 1, height, width)
def test_smoke_batch(self):
batch_size, height, width, channels = 2, 4, 5, 3
img = np.ones((batch_size, height, width, channels))
transforms = torchvision.transforms.Compose([
taug.ToTensor(),
taug.Grayscale(),
])
assert transforms(img).shape == (batch_size, 1, height, width)
def test_smoke(self):
height, width, channels = 4, 5, 3
img = np.ones((height, width, channels))
transforms = torchvision.transforms.Compose([
taug.ToTensor(),
taug.Grayscale(),
])
assert transforms(img).shape == (1, height, width)
def test_smoke(self):
assert str(taug.Grayscale()) == 'Grayscale()'