We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
cross_entropy
1 parent a5a8eeb commit dfa4c26Copy full SHA for dfa4c26
docs/source/training.rst
@@ -109,9 +109,9 @@ The following is equivalent to the previous example:
109
.. code-block:: python
110
111
from torch.nn import functional as F
112
- labels = torch.tensor([1,0]).unsqueeze(0)
+ labels = torch.tensor([1,0])
113
outputs = model(input_ids, attention_mask=attention_mask)
114
- loss = F.cross_entropy(labels, outputs.logitd)
+ loss = F.cross_entropy(outputs.logits, labels)
115
loss.backward()
116
optimizer.step()
117
0 commit comments