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
6ad80444
Unverified
Commit
6ad80444
authored
Nov 07, 2022
by
Philip Meier
Committed by
GitHub
Nov 07, 2022
Browse files
add image or video tolerances for CUDA vs CPU tests (#6924)
parent
81a2e105
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
4 deletions
+25
-4
test/prototype_transforms_kernel_infos.py
test/prototype_transforms_kernel_infos.py
+25
-4
No files found.
test/prototype_transforms_kernel_infos.py
View file @
6ad80444
...
@@ -66,6 +66,11 @@ DEFAULT_PIL_REFERENCE_CLOSENESS_KWARGS = {
...
@@ -66,6 +66,11 @@ DEFAULT_PIL_REFERENCE_CLOSENESS_KWARGS = {
((
"TestKernels"
,
"test_against_reference"
),
torch
.
uint8
,
"cpu"
):
dict
(
atol
=
1e-5
,
rtol
=
0
,
agg_method
=
"mean"
),
((
"TestKernels"
,
"test_against_reference"
),
torch
.
uint8
,
"cpu"
):
dict
(
atol
=
1e-5
,
rtol
=
0
,
agg_method
=
"mean"
),
}
}
CUDA_VS_CPU_SINGLE_PIXEL_DIFFERENCE
=
{
((
"TestKernels"
,
"test_cuda_vs_cpu"
),
dtype
,
"cuda"
):
dict
(
atol
=
atol
,
rtol
=
0
)
for
dtype
,
atol
in
[(
torch
.
uint8
,
1
),
(
torch
.
float32
,
1
/
255
)]
}
def
pil_reference_wrapper
(
pil_kernel
):
def
pil_reference_wrapper
(
pil_kernel
):
@
functools
.
wraps
(
pil_kernel
)
@
functools
.
wraps
(
pil_kernel
)
...
@@ -319,7 +324,10 @@ KERNEL_INFOS.extend(
...
@@ -319,7 +324,10 @@ KERNEL_INFOS.extend(
sample_inputs_fn
=
sample_inputs_resize_image_tensor
,
sample_inputs_fn
=
sample_inputs_resize_image_tensor
,
reference_fn
=
reference_resize_image_tensor
,
reference_fn
=
reference_resize_image_tensor
,
reference_inputs_fn
=
reference_inputs_resize_image_tensor
,
reference_inputs_fn
=
reference_inputs_resize_image_tensor
,
closeness_kwargs
=
DEFAULT_PIL_REFERENCE_CLOSENESS_KWARGS
,
closeness_kwargs
=
{
**
DEFAULT_PIL_REFERENCE_CLOSENESS_KWARGS
,
**
CUDA_VS_CPU_SINGLE_PIXEL_DIFFERENCE
,
},
test_marks
=
[
test_marks
=
[
xfail_jit_python_scalar_arg
(
"size"
),
xfail_jit_python_scalar_arg
(
"size"
),
],
],
...
@@ -346,6 +354,7 @@ KERNEL_INFOS.extend(
...
@@ -346,6 +354,7 @@ KERNEL_INFOS.extend(
KernelInfo
(
KernelInfo
(
F
.
resize_video
,
F
.
resize_video
,
sample_inputs_fn
=
sample_inputs_resize_video
,
sample_inputs_fn
=
sample_inputs_resize_video
,
closeness_kwargs
=
CUDA_VS_CPU_SINGLE_PIXEL_DIFFERENCE
,
),
),
]
]
)
)
...
@@ -1011,7 +1020,10 @@ KERNEL_INFOS.extend(
...
@@ -1011,7 +1020,10 @@ KERNEL_INFOS.extend(
sample_inputs_fn
=
sample_inputs_resized_crop_image_tensor
,
sample_inputs_fn
=
sample_inputs_resized_crop_image_tensor
,
reference_fn
=
reference_resized_crop_image_tensor
,
reference_fn
=
reference_resized_crop_image_tensor
,
reference_inputs_fn
=
reference_inputs_resized_crop_image_tensor
,
reference_inputs_fn
=
reference_inputs_resized_crop_image_tensor
,
closeness_kwargs
=
DEFAULT_PIL_REFERENCE_CLOSENESS_KWARGS
,
closeness_kwargs
=
{
**
DEFAULT_PIL_REFERENCE_CLOSENESS_KWARGS
,
**
CUDA_VS_CPU_SINGLE_PIXEL_DIFFERENCE
,
},
),
),
KernelInfo
(
KernelInfo
(
F
.
resized_crop_bounding_box
,
F
.
resized_crop_bounding_box
,
...
@@ -1027,6 +1039,7 @@ KERNEL_INFOS.extend(
...
@@ -1027,6 +1039,7 @@ KERNEL_INFOS.extend(
KernelInfo
(
KernelInfo
(
F
.
resized_crop_video
,
F
.
resized_crop_video
,
sample_inputs_fn
=
sample_inputs_resized_crop_video
,
sample_inputs_fn
=
sample_inputs_resized_crop_video
,
closeness_kwargs
=
CUDA_VS_CPU_SINGLE_PIXEL_DIFFERENCE
,
),
),
]
]
)
)
...
@@ -1226,7 +1239,10 @@ KERNEL_INFOS.extend(
...
@@ -1226,7 +1239,10 @@ KERNEL_INFOS.extend(
sample_inputs_fn
=
sample_inputs_perspective_image_tensor
,
sample_inputs_fn
=
sample_inputs_perspective_image_tensor
,
reference_fn
=
pil_reference_wrapper
(
F
.
perspective_image_pil
),
reference_fn
=
pil_reference_wrapper
(
F
.
perspective_image_pil
),
reference_inputs_fn
=
reference_inputs_perspective_image_tensor
,
reference_inputs_fn
=
reference_inputs_perspective_image_tensor
,
closeness_kwargs
=
DEFAULT_PIL_REFERENCE_CLOSENESS_KWARGS
,
closeness_kwargs
=
{
**
DEFAULT_PIL_REFERENCE_CLOSENESS_KWARGS
,
**
CUDA_VS_CPU_SINGLE_PIXEL_DIFFERENCE
,
},
),
),
KernelInfo
(
KernelInfo
(
F
.
perspective_bounding_box
,
F
.
perspective_bounding_box
,
...
@@ -1242,6 +1258,7 @@ KERNEL_INFOS.extend(
...
@@ -1242,6 +1258,7 @@ KERNEL_INFOS.extend(
KernelInfo
(
KernelInfo
(
F
.
perspective_video
,
F
.
perspective_video
,
sample_inputs_fn
=
sample_inputs_perspective_video
,
sample_inputs_fn
=
sample_inputs_perspective_video
,
closeness_kwargs
=
CUDA_VS_CPU_SINGLE_PIXEL_DIFFERENCE
,
),
),
]
]
)
)
...
@@ -1442,7 +1459,10 @@ KERNEL_INFOS.extend(
...
@@ -1442,7 +1459,10 @@ KERNEL_INFOS.extend(
KernelInfo
(
KernelInfo
(
F
.
gaussian_blur_image_tensor
,
F
.
gaussian_blur_image_tensor
,
sample_inputs_fn
=
sample_inputs_gaussian_blur_image_tensor
,
sample_inputs_fn
=
sample_inputs_gaussian_blur_image_tensor
,
closeness_kwargs
=
DEFAULT_PIL_REFERENCE_CLOSENESS_KWARGS
,
closeness_kwargs
=
{
**
DEFAULT_PIL_REFERENCE_CLOSENESS_KWARGS
,
**
CUDA_VS_CPU_SINGLE_PIXEL_DIFFERENCE
,
},
test_marks
=
[
test_marks
=
[
xfail_jit_python_scalar_arg
(
"kernel_size"
),
xfail_jit_python_scalar_arg
(
"kernel_size"
),
xfail_jit_python_scalar_arg
(
"sigma"
),
xfail_jit_python_scalar_arg
(
"sigma"
),
...
@@ -1451,6 +1471,7 @@ KERNEL_INFOS.extend(
...
@@ -1451,6 +1471,7 @@ KERNEL_INFOS.extend(
KernelInfo
(
KernelInfo
(
F
.
gaussian_blur_video
,
F
.
gaussian_blur_video
,
sample_inputs_fn
=
sample_inputs_gaussian_blur_video
,
sample_inputs_fn
=
sample_inputs_gaussian_blur_video
,
closeness_kwargs
=
CUDA_VS_CPU_SINGLE_PIXEL_DIFFERENCE
,
),
),
]
]
)
)
...
...
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