Skip to content

Commit

Permalink
Fix import for depreciated torch._six
Browse files Browse the repository at this point in the history
  • Loading branch information
alex391 committed Feb 29, 2024
1 parent 3ca676b commit 63fe258
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
9 changes: 8 additions & 1 deletion bindsnet/datasets/collate.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@
"""

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

# https://github.com/pytorch/pytorch/pull/94709#issuecomment-1461471006
try:
from torch._six import container_abcs, string_classes, int_classes
except ImportError:
int_classes = int
string_classes = str
import collections.abc as container_abcs

from torch.utils.data._utils import collate as pytorch_collate

Expand Down
8 changes: 7 additions & 1 deletion bindsnet/pipeline/base_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
from typing import Tuple, Dict, Any

import torch
from torch._six import container_abcs, string_classes

# https://github.com/pytorch/pytorch/pull/94709#issuecomment-1461471006
try:
from torch._six import container_abcs, string_classes
except ImportError:
string_classes = str
import collections.abc as container_abcs

from ..network import Network
from ..network.monitors import Monitor
Expand Down

0 comments on commit 63fe258

Please sign in to comment.