TypeError: expected size to be one of int or Tuple[int] or Tuple[int, int] or Tuple[int, int, int], but got size with types [<class 'numpy.int32'>, <class 'numpy.int32'>]
Expected behavior:
No error.
Environment:
This seems to only happen with the latest torch=2.1.0
Instructions To Reproduce the 🐛 Bug:
With
torch=2.1.0
DensePoseOutputsTextureVisualizer.visualize
fails with type mismatch problem.Result:
TypeError: expected size to be one of int or Tuple[int] or Tuple[int, int] or Tuple[int, int, int], but got size with types [<class 'numpy.int32'>, <class 'numpy.int32'>]
Expected behavior:
No error.
Environment:
This seems to only happen with the latest
torch=2.1.0
Cause:
This seems to be caused by the
.numpy()
call here: https://github.com/facebookresearch/detectron2/blob/main/projects/DensePose/densepose/vis/densepose_outputs_vertex.py#L193The other visualizer does this with
.int()
instead, which should fix it: https://github.com/facebookresearch/detectron2/blob/main/projects/DensePose/densepose/vis/densepose_outputs_vertex.py#L80