Skip to content

Commit

Permalink
fix: fix bugs about import of torch version
Browse files Browse the repository at this point in the history
  • Loading branch information
L1aoXingyu committed Sep 21, 2021
1 parent f4551a1 commit d9d6e19
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fastreid/data/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import os

import torch
from torch._six import container_abcs, string_classes, int_classes
from torch._six import string_classes
from collections import Mapping

from fastreid.config import configurable
from fastreid.utils import comm
Expand Down Expand Up @@ -175,12 +176,12 @@ def fast_batch_collator(batched_inputs):
out[i] += tensor
return out

elif isinstance(elem, container_abcs.Mapping):
elif isinstance(elem, Mapping):
return {key: fast_batch_collator([d[key] for d in batched_inputs]) for key in elem}

elif isinstance(elem, float):
return torch.tensor(batched_inputs, dtype=torch.float64)
elif isinstance(elem, int_classes):
elif isinstance(elem, int):
return torch.tensor(batched_inputs)
elif isinstance(elem, string_classes):
return batched_inputs

0 comments on commit d9d6e19

Please sign in to comment.