Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/test_transforms_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,7 @@ def test_ctor(self, transform_cls, trfms):

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


Expand Down
2 changes: 1 addition & 1 deletion test/test_transforms_v2_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ def test_random_choice(self, probabilities):
v2_transforms.Resize(256),
legacy_transforms.CenterCrop(224),
],
probabilities=probabilities,
p=probabilities,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: should we also rename the parameter to p?

Suggested change
p=probabilities,
p=p,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is ok

)
legacy_transform = legacy_transforms.RandomChoice(
[
Expand Down
2 changes: 1 addition & 1 deletion torchvision/transforms/v2/_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def __init__(
p = [1] * len(transforms)
elif len(p) != len(transforms):
raise ValueError(
f"The number of p doesn't match the number of transforms: " f"{len(p)} != {len(transforms)}"
f"Length of p doesn't match the number of transforms: " f"{len(p)} != {len(transforms)}"
)

super().__init__()
Expand Down