Follow this issue,
  
    
    
    How to extract learned weights correctly 
  
  
    I can’t repeat your error, my idea is that your problem comes from your data set: 
model = Net()
optimizer = optim.Adam(model.parameters(), 0.01)
criterion = nn.MSELoss()

def train(epochs):
    model.train()
    for epoch in range(1, epochs+1):
        # I dont have your data set:
        data = Variable(torch.rand(1,100))
        target = Variable(torch.ones(1,100))
        optimizer.zero_grad()
        output = model(data)
        loss = criterion(output, target)
        loss.backward()
     …
  


Is there a way to get the sum of weights.data by channel dim? Thanks!