i have simple problem 4 input length and 3 output required against 4 inputs.
------------------------------ tensor([[3411.0554, 3316.2825, 2679.5391, 2864.1514]])
------------------------------ tensor([[ 587.7465, 1382.9791,  339.3717]], grad_fn=) tensor([ -43.2563, -250.4521, 1020.8250])
_----------------------------------------------------------------- torch.Size([3, 1])
class Net(nn.Module):
def init(self, input_size, hidden_size, num_classes):
super(Net, self).init()
self.fc1 = nn.Linear(input_size, hidden_size)
self.relu = nn.ReLU()
self.fc2 = nn.Linear(hidden_size, num_classes)
def forward(self, x):
    out = self.fc1(x)
    out = self.relu(out)
    out = self.fc2(out)
    return out

net = Net(input_size, hidden_size, num_classes)
#net.cuda()
Loss and Optimizer
criterion = nn.MSELoss()
optimizer = torch.optim.Adam(net.parameters(), lr=learning_rate)
Train the Model
for epoch in range(num_epochs):
for i, data in enumerate(train_loader, 0):
# get the inputs
inputs, labels = data
    # wrap them in Variable
    inputs = Variable(inputs.view(-1, 1*4))
    labels = Variable(labels.view(3,))
    #target = Variable(torch.FloatTensor()
    print("------------------------------",inputs.data)

    # Forward + Backward + Optimize
    optimizer.zero_grad()  # zero the gradient buffer
    outputs = net(inputs.float())
    print("------------------------------",outputs,labels)
    labels = labels.float()
    outputs = outputs.transpose(0, 1)
    print("_-----------------------------------------------------------------",outputs.shape)
    output1 = outputs.data[0][0]
    label1 = labels.data[0]
    output2 = outputs.data[1][0]
    label2 = labels.data[1]
    output3 = outputs.data[2][0]
    label3 = labels.data[2]
    print(type(label1))
    print("outputssssssssssssss",output1,output2,output3,label3)
    loss1 = criterion(output1.data,label1)
    loss2 = criterion(output2.data,label2)
    loss3 = criterion(output3.data,label3)
    print("loss -----------------------------------",loss1)
    loss = loss1+loss2+loss3

    loss.backward()
    optimizer.step()
    print(loss)
    
    if (i+1) % 100 == 0:
        print ('Epoch [%d/%d], Step [%d/%d], Loss: %.4f' 
               %(epoch+1, num_epochs, i+1, len(train_loader)//batch_size, loss.data[0]))