Hello,
I am new to pytorch and I am trying to predict diabetes classification.
import torch.optim as optim
import torch
import numpy as np
from torch.autograd import Variable
from torch.utils.data import Dataset, DataLoader
model = DeepNet(8)
#8 input features, and 3 outputs

optimizer = optim.SGD(model.parameters(), lr=0.0001)
loss_fn = nn.CrossEntropyLoss()
#batch size of 200 is indicated in the parameters of the dataloader.
loss_list = []
for epoch in range(100):  # loop over the dataset for 100 epochs
    avg_loss = 0
    for index, data in enumerate(train_loader, 0):  
        inputs, labels = data
        inputs, labels = Variable(inputs), Variable(labels)
        
        optimizer.zero_grad()

        outputs = model(inputs)
        print(inputs.size(), labels.size(), outputs.size())
        loss = loss_fn(outputs, labels.long())
        avg_loss += loss.data.numpy().ravel()[0]
        loss.backward()
        optimizer.step()
    loss_list.append(avg_loss/inputs.shape[0])
plt.plot(loss_list)
print("The loss value at 100th epoch:", loss_list[99])

However, I am having an error: multi-target not supported at c:\a\w\1\s\tmp_conda_3.6_091443\conda\conda-bld\pytorch_1544087948354\work\aten\src\thnn\generic/ClassNLLCriterion.c:21."
Here are the sizes of the inputs, labels, and outputs, respectively:
torch.Size([200, 8]) torch.Size([200, 1]) torch.Size([200, 3])
Any help is greatly appreciated! Thank you very much!