@ptrblck Thanks for such faster help. Here torch.LongTensor(nodes) is giving error where nodes are already simple tensors.
class Encoder(nn.Module):
  def __init__(self,features,adj_matrix,embed_dim,feature_dim,agg,cuda):#in our case its ppi feat dim
    super(Encoder,self).__init__()
    self.features = features
    self.adj_matrix = adj_matrix
    self.embed_dim = embed_dim
    self.weight = nn.Parameter(torch.torch.FloatTensor(embed_dim,2*feature_dim))
    init.xavier_uniform(self.weight)
    self.aggregation = agg
    self.cuda = cuda
    self.aggregation.cuda = cuda
  def forward(self,nodes):
    #print("checking one neigh ",[self.adj_matrix[int(nodes[0])],self.adj_matrix[int(nodes[2])]])
    agg = self.aggregation(nodes,[self.adj_matrix[int(node)] for node in nodes],num_sample=40)
    #print("checks ",agg.is_cuda,"nodes ",torch.LongTensor(nodes).is_cuda)
    if self.cuda:
      print(type(nodes))
      print(type(self.features),torch.LongTensor(nodes).is_cuda)
      node_embed = self.features(torch.LongTensor(nodes))
    else:
        node_embed = self.features(torch.LongTensor(nodes))#.cuda()
    print("working one agg of nodes too")#,node_embed.is_cuda,agg.is_cuda)
    fe1 = torch.cat([node_embed,agg],dim=1)
    #print("checking fe1 ",fe1.is_cuda)
    if self.weight.is_cuda:
      fe1 = fe1.cuda()
    fe2 = F.relu(self.weight.mm(fe1.t()))
    return fe2