Skip to content

Commit 04af73a

Browse files
NicolasHugfacebook-github-bot
authored andcommitted
[fbsync] Fixed broken test_random_choice (#7315)
Reviewed By: vmoens Differential Revision: D44416538 fbshipit-source-id: cc263e069795e0059f9a6708976f1f8232c9a304
1 parent edba591 commit 04af73a

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

test/test_transforms_v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,7 @@ def test_ctor(self, transform_cls, trfms):
13591359

13601360
class TestRandomChoice:
13611361
def test_assertions(self):
1362-
with pytest.raises(ValueError, match="The number of probabilities doesn't match the number of transforms"):
1362+
with pytest.raises(ValueError, match="Length of p doesn't match the number of transforms"):
13631363
transforms.RandomChoice([transforms.Pad(2), transforms.RandomCrop(28)], p=[1])
13641364

13651365

test/test_transforms_v2_consistency.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ def test_random_choice(self, probabilities):
822822
v2_transforms.Resize(256),
823823
legacy_transforms.CenterCrop(224),
824824
],
825-
probabilities=probabilities,
825+
p=probabilities,
826826
)
827827
legacy_transform = legacy_transforms.RandomChoice(
828828
[

torchvision/transforms/v2/_container.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def __init__(
139139
p = [1] * len(transforms)
140140
elif len(p) != len(transforms):
141141
raise ValueError(
142-
f"The number of p doesn't match the number of transforms: " f"{len(p)} != {len(transforms)}"
142+
f"Length of p doesn't match the number of transforms: " f"{len(p)} != {len(transforms)}"
143143
)
144144

145145
super().__init__()

0 commit comments

Comments
 (0)