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_smoke(self):
angle = 0.0
angle_t = torch.Tensor([angle])
assert str(taug.Rotate(angle=angle_t)) == 'Rotate(angle=0.0, center=None)'
# prepare input data
inp = torch.FloatTensor([[
[1, 2],
[3, 4],
[5, 6],
[7, 8],
]])
expected = torch.FloatTensor([[
[0, 0],
[4, 6],
[3, 5],
[0, 0],
]])
# prepare transformation
angle_t = torch.Tensor([90])
transform = taug.Rotate(angle_t)
assert_allclose(transform(inp), expected)
[7, 8],
]]).repeat(2, 1, 1, 1)
expected = torch.FloatTensor([[[
[0, 0],
[4, 6],
[3, 5],
[0, 0],
]],[[
[0, 0],
[5, 3],
[6, 4],
[0, 0],
]]])
# prepare transformation
angle_t = torch.Tensor([90, -90])
transform = taug.Rotate(angle_t)
assert_allclose(transform(inp), expected)