It’s because of the following code in __get_attr__ but also in the rest of this file:

  
      github.com
  
  
    pytorch/pytorch/blob/d1a44676828ef65067414c938b15412f85d1a39e/torch/nn/modules/module.py#L225-L283 20

def __getattr__(self, name):
    if '_parameters' in self.__dict__:
        _parameters = self.__dict__['_parameters']
        if name in _parameters:
            return _parameters[name]
    if '_buffers' in self.__dict__:
        _buffers = self.__dict__['_buffers']
        if name in _buffers:
            return _buffers[name]
    if '_modules' in self.__dict__:
        modules = self.__dict__['_modules']
        if name in modules:
            return modules[name]
    raise AttributeError("'{}' object has no attribute '{}'".format(
        type(self).__name__, name))


def __setattr__(self, name, value):
    def remove_from(*dicts):
        for d in dicts:
            if name in d:


  This file has been truncated. show original