Unverified Commit 65d50d0f authored by Edward Z. Yang's avatar Edward Z. Yang Committed by GitHub
Browse files

Avoid creating a tensor of shape when not tracing (#7942)


Signed-off-by: default avatarEdward Z. Yang <ezyang@meta.com>
parent e13b8f5c
......@@ -31,8 +31,10 @@ def _resize_image_and_masks(
) -> Tuple[Tensor, Optional[Dict[str, Tensor]]]:
if torchvision._is_tracing():
im_shape = _get_shape_onnx(image)
else:
elif torch.jit.is_scripting():
im_shape = torch.tensor(image.shape[-2:])
else:
im_shape = image.shape[-2:]
size: Optional[List[int]] = None
scale_factor: Optional[float] = None
......
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