Exemplo n.º 1
0
 def test_num_levels(self, batch_size, channels, max_level):
     height, width = 16, 20
     input = torch.rand(batch_size, channels, height, width)
     pyramid = kornia.build_pyramid(input, max_level)
     assert len(pyramid) == max_level
     for i in range(1, max_level):
         img = pyramid[i]
         denom = 2 ** i
         expected_shape = (batch_size, channels, height // denom, width // denom)
         assert img.shape == expected_shape
Exemplo n.º 2
0
 def test_smoke(self, device, dtype):
     input = torch.ones(1, 2, 4, 5, device=device, dtype=dtype)
     pyramid = kornia.build_pyramid(input, max_level=1)
     assert len(pyramid) == 1
     assert pyramid[0].shape == (1, 2, 4, 5)