"examples/pytorch/git@developer.sourcefind.cn:OpenDAS/dgl.git" did not exist on "88a042d34a96e73446c7ddc141b7785413dd9501"
Unverified Commit 455eda68 authored by Philip Meier's avatar Philip Meier Committed by GitHub
Browse files

fix Resize for JIT single value sequences (#7139)

parent 1496ff0c
...@@ -74,6 +74,7 @@ CONSISTENCY_CONFIGS = [ ...@@ -74,6 +74,7 @@ CONSISTENCY_CONFIGS = [
legacy_transforms.Resize, legacy_transforms.Resize,
[ [
ArgsKwargs(32), ArgsKwargs(32),
ArgsKwargs([32]),
ArgsKwargs((32, 29)), ArgsKwargs((32, 29)),
ArgsKwargs((31, 28), interpolation=prototype_transforms.InterpolationMode.NEAREST), ArgsKwargs((31, 28), interpolation=prototype_transforms.InterpolationMode.NEAREST),
ArgsKwargs((33, 26), interpolation=prototype_transforms.InterpolationMode.BICUBIC), ArgsKwargs((33, 26), interpolation=prototype_transforms.InterpolationMode.BICUBIC),
......
...@@ -46,11 +46,16 @@ class Resize(Transform): ...@@ -46,11 +46,16 @@ class Resize(Transform):
) -> None: ) -> None:
super().__init__() super().__init__()
self.size = ( if isinstance(size, int):
[size] size = [size]
if isinstance(size, int) elif isinstance(size, (list, tuple)) and len(size) in {1, 2}:
else _setup_size(size, error_msg="Please provide only two dimensions (h, w) for size.") size = list(size)
) else:
raise ValueError(
f"size can either be an integer or a list or tuple of one or two integers, " f"but got {size} instead."
)
self.size = size
self.interpolation = interpolation self.interpolation = interpolation
self.max_size = max_size self.max_size = max_size
self.antialias = antialias self.antialias = antialias
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment