Skip to content
This repository has been archived by the owner on Dec 15, 2021. It is now read-only.

Commit

Permalink
Update ImageList to work with 3d tensors (facebookresearch#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmassa committed Mar 7, 2019
1 parent 43345f4 commit 1a744b9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions maskrcnn_benchmark/structures/image_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def to_image_list(tensors, size_divisible=0):
return tensors
elif isinstance(tensors, torch.Tensor):
# single tensor shape can be inferred
if tensors.dim() == 3:
tensors = tensors[None]
assert tensors.dim() == 4
image_sizes = [tensor.shape[-2:] for tensor in tensors]
return ImageList(tensors, image_sizes)
Expand Down

0 comments on commit 1a744b9

Please sign in to comment.