Solved by KFrank in post #3 
              
              
                Hi Chris! 

You can get a tensor of weights corresponding to the class labels 
in t by indexing into w, and you can get a tensor of (negative) 
log-probabilities by calling .take_along_dim() with t as the 
argument: 
>>> import torch
>>> torch.__version__
'1.9.0'
>>> _ = torch.manual_seed (2021)
>>> …