diff options
author | Jeff Smith <jeffksmith@fb.com> | 2018-09-13 15:04:43 -0700 |
---|---|---|
committer | Facebook Github Bot <facebook-github-bot@users.noreply.github.com> | 2018-09-13 15:09:22 -0700 |
commit | 05e06f7de2c84b8dd770c2f5008f5b7620e97d39 (patch) | |
tree | eabf49eb2e8712e0932b462138b5ccec8edfa8ca /torch/optim | |
parent | 29e29ca6ee82ae40da6142faeba3bb6f78a17b63 (diff) | |
download | pytorch-05e06f7de2c84b8dd770c2f5008f5b7620e97d39.tar.gz pytorch-05e06f7de2c84b8dd770c2f5008f5b7620e97d39.tar.bz2 pytorch-05e06f7de2c84b8dd770c2f5008f5b7620e97d39.zip |
migrating deprecated calls without abc module for containers (#11515)
Summary:
Implementing #10540.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/11515
Reviewed By: apaszke
Differential Revision: D9771045
Pulled By: jeffreyksmithjr
fbshipit-source-id: 85ea39abaa9b465805a969f122b626b11fc85ef6
Diffstat (limited to 'torch/optim')
-rw-r--r-- | torch/optim/optimizer.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/torch/optim/optimizer.py b/torch/optim/optimizer.py index 21f69bb828..41c1e916f4 100644 --- a/torch/optim/optimizer.py +++ b/torch/optim/optimizer.py @@ -1,4 +1,5 @@ -from collections import defaultdict, Iterable +from collections import defaultdict +from torch._six import container_abcs import torch from copy import deepcopy @@ -123,7 +124,7 @@ class Optimizer(object): return value elif isinstance(value, dict): return {k: cast(param, v) for k, v in value.items()} - elif isinstance(value, Iterable): + elif isinstance(value, container_abcs.Iterable): return type(value)(cast(param, v) for v in value) else: return value |