File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2323
2424from .configuration_utils import ConfigMixin , register_to_config
2525from .utils import CONFIG_NAME , PIL_INTERPOLATION , deprecate
26+ from .utils .pil_utils import TORCH_INTERPOLATION
2627
2728
2829PipelineImageInput = (
@@ -506,15 +507,21 @@ def resize(
506507 raise ValueError (f"resize_mode { resize_mode } is not supported" )
507508
508509 elif isinstance (image , torch .Tensor ):
510+ torch_mode , use_antialias = TORCH_INTERPOLATION [self .config .resample ]
509511 image = torch .nn .functional .interpolate (
510512 image ,
511513 size = (height , width ),
514+ mode = torch_mode ,
515+ antialias = use_antialias ,
512516 )
513517 elif isinstance (image , np .ndarray ):
518+ torch_mode , use_antialias = TORCH_INTERPOLATION [self .config .resample ]
514519 image = self .numpy_to_pt (image )
515520 image = torch .nn .functional .interpolate (
516521 image ,
517522 size = (height , width ),
523+ mode = torch_mode ,
524+ antialias = use_antialias ,
518525 )
519526 image = self .pt_to_numpy (image )
520527
You can’t perform that action at this time.
0 commit comments