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
f81d68aa
You need to sign in or sign up before continuing.
Unverified
Commit
f81d68aa
authored
Jun 22, 2023
by
Nicolas Hug
Committed by
GitHub
Jun 22, 2023
Browse files
Fix test RNG (#7693)
parent
f02caa53
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
test/test_transforms_v2_consistency.py
test/test_transforms_v2_consistency.py
+7
-0
test/test_transforms_v2_refactored.py
test/test_transforms_v2_refactored.py
+7
-0
No files found.
test/test_transforms_v2_consistency.py
View file @
f81d68aa
...
...
@@ -22,6 +22,7 @@ from common_utils import (
make_image
,
make_images
,
make_segmentation_mask
,
set_rng_seed
,
)
from
torch
import
nn
from
torchvision
import
datapoints
,
transforms
as
legacy_transforms
...
...
@@ -35,6 +36,12 @@ from torchvision.transforms.v2.utils import query_spatial_size
DEFAULT_MAKE_IMAGES_KWARGS
=
dict
(
color_spaces
=
[
"RGB"
],
extra_dims
=
[(
4
,)])
@
pytest
.
fixture
(
autouse
=
True
)
def
fix_rng_seed
():
set_rng_seed
(
0
)
yield
class
NotScriptableArgsKwargs
(
ArgsKwargs
):
"""
This class is used to mark parameters that render the transform non-scriptable. They still work in eager mode and
...
...
test/test_transforms_v2_refactored.py
View file @
f81d68aa
...
...
@@ -21,6 +21,7 @@ from common_utils import (
make_image
,
make_segmentation_mask
,
make_video
,
set_rng_seed
,
)
from
torch.testing
import
assert_close
from
torchvision
import
datapoints
...
...
@@ -28,6 +29,12 @@ from torchvision.transforms.functional import pil_modes_mapping
from
torchvision.transforms.v2
import
functional
as
F
@
pytest
.
fixture
(
autouse
=
True
)
def
fix_rng_seed
():
set_rng_seed
(
0
)
yield
def
_to_tolerances
(
maybe_tolerance_dict
):
if
not
isinstance
(
maybe_tolerance_dict
,
dict
):
return
dict
(
rtol
=
None
,
atol
=
None
)
...
...
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