Exercise

# Loss function of random scores

If the neural network predicts random scores, what would be its loss function? Let's find it out in PyTorch. The neural network is going to have 1000 classes, each having a random score. For ground truth, it will have class 111. Calculate the loss function.

Instructions

**100 XP**

- Import
`torch`

and`torch.nn as nn`

- Initialize
`logits`

with a random tensor of shape`(1, 1000)`

and`ground_truth`

with a tensor containing the number`111`

. - Instantiate the cross-entropy loss in a variable called
`criterion`

. - Calculate and print the loss function.