Could you explain little more in details this line of your code:
target = torch.zeros(labels.size(0), 15).scatter_(1, labels, 1.)
Why did you choose dimension of 1 in 1st argument of scatter function and where number 15 came from ?
Also, I don’t need to change the format of my data outputs right?
And how to measure loss during the loop of my iterations? Will the following metric be good for that?

losses =  [ ]
loss = loss_fn (prediction, to_variable(target))  # Compute losses
            loss.backward()  # Backpropagate the gradients
            losses.append(loss.data.cpu().numpy())
            optim.step()  # Update the network
        print("Epoch {} Loss: {:.4f}".format(epoch, np.asscalar(np.mean(losses))))