AttributeError: module ‘torch.nn.parameter‘ has no attribute ‘UninitializedParameter‘

created at 01-31-2022 views: 20


Traceback (most recent call last):
  File "E:/Program Files/PyCharm 2019.2/PyG/", line 63, in <module>
    model = GCN_NET(dataset.num_node_features, 16, dataset.num_classes).to(device)
  File "E:/Program Files/PyCharm 2019.2/PyG/", line 45, in __init__
    self.conv1 = GCNConv(features, hidden)  # shape(输入的节点特征维度 * 中间隐藏层的维度)
  File "F:\Anaconda3\lib\site-packages\torch_geometric\nn\conv\", line 140, in __init__
  File "F:\Anaconda3\lib\site-packages\torch_geometric\nn\dense\", line 65, in __init__
  File "F:\Anaconda3\lib\site-packages\torch_geometric\nn\dense\", line 78, in reset_parameters
    if isinstance(self.weight, nn.parameter.UninitializedParameter):
AttributeError: module 'torch.nn.parameter' has no attribute 'UninitializedParameter'


My current PyTorch version is 1.5.1, and torch.nn.parameter does not have the UninitializedParameter property, so PyTorch needs to be upgraded.

It is not recommended to run directly:

conda install pytorch torchvision torchaudio -c pytorch

It is recommended to download the whl file on the official website and then pass:

pip install path

where path is the file path.

created at:01-31-2022
edited at: 01-31-2022: