Hi there,
Could anyone help me resolve this issue of mine?
from __future__ import division

import igraph as ig
import os
import torch
import torch.nn as nn
import torch.optim as optim
import torch.utils.data as Data

from demo.graphcc import *


class SDNE(nn.Module):
    def __init__(self, encode_dim, N, batch_size=128):
        super(SDNE, self).__init__()
        self.encode_dim = encode_dim
        self.vectors = {}
        self.N = N
        self.batch_size = batch_size
        if encode_dim == 4:
            self.linear1 = nn.Linear(self.N, 5000)
            self.linear2 = nn.Linear(5000, 1000)
            self.linear3 = nn.Linear(1000, 100)
            self.linear4 = nn.Linear(100, 1000)
            self.linear5 = nn.Linear(1000, 5000)
            self.linear6 = nn.Linear(5000, self.N)
        if encode_dim == 3:
            self.linear1 = nn.Linear(self.N, 1000)
            self.linear2 = nn.Linear(1000, 100)
            self.linear3 = nn.Linear(100, 1000)
            self.linear4 = nn.Linear(1000, self.N)

    def forward(self, x):
        if self.encode_dim == 3:
            emb = nn.Sigmoid(self.linear1(x))
            emb = nn.Sigmoid(self.linear2(emb))
            recon = nn.Sigmoid(self.linear3(emb))
            recon = nn.Sigmoid(self.linear4(recon))
        else:
            emb = nn.Sigmoid(self.linear1(x))
            emb = nn.Sigmoid(self.linear2(emb))
            emb = nn.Sigmoid(self.linear3(emb))
            recon = nn.Sigmoid(self.linear4(emb))
            recon = nn.Sigmoid(self.linear5(recon))
            recon = nn.Sigmoid(self.linear6(recon))

        # returning embedding embedding layer and reconstruction output
        return emb, recon


This is the error that obtained
‘’’
Traceback (most recent call last):
File “/anaconda/envs/py35/lib/python3.5/site-packages/IPython/core/interactiveshell.py”, line 2963, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File “”, line 1, in 
embedding_final = train(model, optimizer, weighted_adj)
File “”, line 98, in train
emb_batch, recon_batch = m(data)
File “/anaconda/envs/py35/lib/python3.5/site-packages/torch/nn/modules/module.py”, line 489, in call
result = self.forward(*input, **kwargs)
File “”, line 52, in forward
emb = nn.Sigmoid(self.linear1(x))
File “/anaconda/envs/py35/lib/python3.5/site-packages/torch/nn/modules/module.py”, line 489, in call
result = self.forward(*input, **kwargs)
File “/anaconda/envs/py35/lib/python3.5/site-packages/torch/nn/modules/linear.py”, line 67, in forward
return F.linear(input, self.weight, self.bias)
File “/anaconda/envs/py35/lib/python3.5/site-packages/torch/nn/functional.py”, line 1350, in linear
if input.dim() == 2 and bias is not None:
AttributeError: ‘list’ object has no attribute ‘dim’
‘’’
Cheers,
XZ