Unverified Commit e00f4e66 authored by Mark Harfouche's avatar Mark Harfouche Committed by GitHub
Browse files

Help make test dependent on randint compatible with python 3.12 (#8119)


Co-authored-by: default avatarNicolas Hug <nh.nicolas.hug@gmail.com>
parent dd66a9d8
...@@ -1614,8 +1614,8 @@ def test_augmix(fill, severity, mixture_width, chain_depth, all_ops, grayscale): ...@@ -1614,8 +1614,8 @@ def test_augmix(fill, severity, mixture_width, chain_depth, all_ops, grayscale):
def test_random_crop(): def test_random_crop():
height = random.randint(10, 32) * 2 height = random.randint(10, 32) * 2
width = random.randint(10, 32) * 2 width = random.randint(10, 32) * 2
oheight = random.randint(5, (height - 2) / 2) * 2 oheight = random.randint(5, (height - 2) // 2) * 2
owidth = random.randint(5, (width - 2) / 2) * 2 owidth = random.randint(5, (width - 2) // 2) * 2
img = torch.ones(3, height, width, dtype=torch.uint8) img = torch.ones(3, height, width, dtype=torch.uint8)
result = transforms.Compose( result = transforms.Compose(
[ [
...@@ -1664,8 +1664,8 @@ def test_random_crop(): ...@@ -1664,8 +1664,8 @@ def test_random_crop():
def test_center_crop(): def test_center_crop():
height = random.randint(10, 32) * 2 height = random.randint(10, 32) * 2
width = random.randint(10, 32) * 2 width = random.randint(10, 32) * 2
oheight = random.randint(5, (height - 2) / 2) * 2 oheight = random.randint(5, (height - 2) // 2) * 2
owidth = random.randint(5, (width - 2) / 2) * 2 owidth = random.randint(5, (width - 2) // 2) * 2
img = torch.ones(3, height, width, dtype=torch.uint8) img = torch.ones(3, height, width, dtype=torch.uint8)
oh1 = (height - oheight) // 2 oh1 = (height - oheight) // 2
......
...@@ -23,8 +23,8 @@ class TestVideoTransforms: ...@@ -23,8 +23,8 @@ class TestVideoTransforms:
numFrames = random.randint(4, 128) numFrames = random.randint(4, 128)
height = random.randint(10, 32) * 2 height = random.randint(10, 32) * 2
width = random.randint(10, 32) * 2 width = random.randint(10, 32) * 2
oheight = random.randint(5, (height - 2) / 2) * 2 oheight = random.randint(5, (height - 2) // 2) * 2
owidth = random.randint(5, (width - 2) / 2) * 2 owidth = random.randint(5, (width - 2) // 2) * 2
clip = torch.randint(0, 256, (numFrames, height, width, 3), dtype=torch.uint8) clip = torch.randint(0, 256, (numFrames, height, width, 3), dtype=torch.uint8)
result = Compose( result = Compose(
[ [
...@@ -41,8 +41,8 @@ class TestVideoTransforms: ...@@ -41,8 +41,8 @@ class TestVideoTransforms:
numFrames = random.randint(4, 128) numFrames = random.randint(4, 128)
height = random.randint(10, 32) * 2 height = random.randint(10, 32) * 2
width = random.randint(10, 32) * 2 width = random.randint(10, 32) * 2
oheight = random.randint(5, (height - 2) / 2) * 2 oheight = random.randint(5, (height - 2) // 2) * 2
owidth = random.randint(5, (width - 2) / 2) * 2 owidth = random.randint(5, (width - 2) // 2) * 2
clip = torch.randint(0, 256, (numFrames, height, width, 3), dtype=torch.uint8) clip = torch.randint(0, 256, (numFrames, height, width, 3), dtype=torch.uint8)
result = Compose( result = Compose(
[ [
...@@ -59,8 +59,8 @@ class TestVideoTransforms: ...@@ -59,8 +59,8 @@ class TestVideoTransforms:
numFrames = random.randint(4, 128) numFrames = random.randint(4, 128)
height = random.randint(10, 32) * 2 height = random.randint(10, 32) * 2
width = random.randint(10, 32) * 2 width = random.randint(10, 32) * 2
oheight = random.randint(5, (height - 2) / 2) * 2 oheight = random.randint(5, (height - 2) // 2) * 2
owidth = random.randint(5, (width - 2) / 2) * 2 owidth = random.randint(5, (width - 2) // 2) * 2
clip = torch.ones((numFrames, height, width, 3), dtype=torch.uint8) * 255 clip = torch.ones((numFrames, height, width, 3), dtype=torch.uint8) * 255
oh1 = (height - oheight) // 2 oh1 = (height - oheight) // 2
......
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