π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
Merge pull request #150 from jiangwei221/feat/batch_tensor_2_img
Edgar Riba289ab297fba0
diff --cc test/utils/test_image.pyindex 4f97bb053,baa11cf28..1775ba06d--- a/test/utils/test_image.py+++ b/test/utils/test_image.py@@@ -3,15 -3,20 +3,19 @@@ import numpy as nimport torchimport kornia as kornia--import utils # test utils+import kornia.testing as utils # test utils- @pytest.mark.parametrize("batch_shape",- [(4, 4), (1, 4, 4), (3, 4, 4), ])- def test_tensor_to_image(batch_shape):- tensor = torch.ones(batch_shape)+ @pytest.mark.parametrize("input_shape, expected",+ [((4, 4), (4, 4)),+ ((1, 4, 4), (4, 4, 1)),+ ((3, 4, 4), (4, 4, 3)),+ ((2, 3, 4, 4), (2, 4, 4, 3)),+ ((1, 3, 4, 4), (1, 4, 4, 3)), ])+ def test_tensor_to_image(input_shape, expected):+ tensor = torch.ones(input_shape)image = kornia.utils.tensor_to_image(tensor)- assert image.shape[:2] == batch_shape[-2:]+ assert image.shape == expectedassert isinstance(image, np.ndarray)