Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
aef00c4d
Unverified
Commit
aef00c4d
authored
Feb 24, 2023
by
vfdev
Committed by
GitHub
Feb 24, 2023
Browse files
Fixed broken test_random_choice (#7315)
parent
74e33657
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
3 deletions
+3
-3
test/test_transforms_v2.py
test/test_transforms_v2.py
+1
-1
test/test_transforms_v2_consistency.py
test/test_transforms_v2_consistency.py
+1
-1
torchvision/transforms/v2/_container.py
torchvision/transforms/v2/_container.py
+1
-1
No files found.
test/test_transforms_v2.py
View file @
aef00c4d
...
...
@@ -1359,7 +1359,7 @@ class TestContainers:
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
])
...
...
test/test_transforms_v2_consistency.py
View file @
aef00c4d
...
...
@@ -822,7 +822,7 @@ class TestContainerTransforms:
v2_transforms
.
Resize
(
256
),
legacy_transforms
.
CenterCrop
(
224
),
],
p
robabilities
=
probabilities
,
p
=
probabilities
,
)
legacy_transform
=
legacy_transforms
.
RandomChoice
(
[
...
...
torchvision/transforms/v2/_container.py
View file @
aef00c4d
...
...
@@ -139,7 +139,7 @@ class RandomChoice(Transform):
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__
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment