I’m working on a sentence sentiment classification network that averages pre-trained word embeddings. My input consists of embedding indices and a binary label. According to NLLLoss documentation, there should be a single target tensor for a mini-batch N of training examples:

Input: (N,C) where C = number of classes

Target: (N) where each value is 0 <= targets[i] <= C-1

In other words, for a mini-batch size of N=3, a target tensor should look like:

`target = autograd.Variable(torch.LongTensor([1, 0, 1]))`

How do I load data into DataLoader to satisfy this requirement? I’m currently providing (tensor_idx, target_label) *for each example* in the batch as a list of dictionaries:

```
x = get_tensor_idx(tokens, word_to_idx, MAX_SENT_LEN)
sample = {'x': x, 'y': torch.from_numpy(np.array([label], dtype=np.int64))}
train_data.append(sample)
...
train_data_loader = torch.utils.data.DataLoader(train_data, ...)
```

However, this approach results in a run-time error:

`RuntimeError: multi-target not supported at /pytorch/torch/lib/THNN/generic/ClassNLLCriterion.c:22`

So how do I correctly feed my (tensor_idx, target_label) into the DataLoader?