attributeError on `_rebuild_tensor` caused conda install avoided by pip install
<SCODE>    ", ".join([t for t in dir(torch._utils)])
                                                            ### inside _utils we have the following function, but why not shown up???

                                                            # def _rebuild_tensor(storage, storage_offset, size, stride):
                                                            #     class_name = storage.__class__.__name__.replace('Storage', 'Tensor')
                                                            #     module = importlib.import_module(storage.__module__)
                                                            #     tensor_class = getattr(module, class_name)
                                                            #     return tensor_class().set_(storage, storage_offset, size, stride)

# output is the following
# '__builtins__, __cached__, __doc__, __file__, __loader__, __name__, __package__, __spec__, 
# _accumulate, _cuda, _import_dotted_name, _range, _type, torch'
<ECODE> <SCODE>", ".join([t for t in dir(torch.tensor)])

# output is the following
# '_TensorBase, __builtins__, __cached__, __doc__, __file__, __loader__, __name__, __package__, 
# __spec__, _cuda, _range, _tensor_str, _type, sys, torch'
<ECODE> Guesses <SCODE>ERROR: test_serialization_map_location (__main__.TestTorch)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_torch.py", line 2711, in test_serialization_map_location
    tensor = torch.load(test_file_path, map_location=map_location)
  File "/Users/Natsume/miniconda2/envs/dlnd-tf-lab/lib/python3.5/site-packages/torch/serialization.py", line 222, in load
    return _load(f, map_location, pickle_module)
  File "/Users/Natsume/miniconda2/envs/dlnd-tf-lab/lib/python3.5/site-packages/torch/serialization.py", line 370, in _load
    result = unpickler.load()
AttributeError: Can't get attribute '_rebuild_tensor' on <module 'torch._utils' from '/Users/Natsume/miniconda2/envs/dlnd-tf-lab/lib/python3.5/site-packages/torch/_utils.py'>
<ECODE> Solution worked this time <SCODE>Exception ignored in: <function WeakValueDictionary.__init__.<locals>.remove at 0x114c5da60>
Traceback (most recent call last):
  File "/Users/Natsume/miniconda2/envs/pytorch-experiment/lib/python3.5/weakref.py", line 117, in remove
TypeError: 'NoneType' object is not callable
<ECODE> should I be worried about this one? Thanks a lot!
dl4daniel
I met the same problem. The reason may be the version of the pretrained model you load doesn’t match with your pytorch.
cslxiao