Also (sporadically) running into a similar error in the same .cpp file (I’m using a loss function based on stochastic indices into an embedding bank on Ubuntu 18.04). Would love to hear about these errors.
File “pytorch_fun.py”, line 541, in 
loss = LALoss(embeddings, emb_idx, toy_bank, cluster_I, args, val=False, centroid_index=centroid_index)

File “pytorch_fun.py”, line 504, in LALoss
NNL_close_background -= torch.log(torch.exp((bank[list(close_background_I[emb_i])] @ embeddings[emb_i].unsqueeze(-1))/args['tau']).sum())

RuntimeError: invalid argument 13: ldc should be at least max(1, m=0), but have 0 at /pytorch/aten/src/TH/generic/THBlas.cpp:367
Update: I believe this error is occurring when matrix multiplications are attempted with tensors having a first dimension shape value of zero (i.e. when the list index into bank has a length of zero) with the other tensor having non-zero shape values in both of the dimensions of the tensor having a zero shape value (only when unsqueeze is used; see below). I was not aware that PyTorch supported tensors with shape values of zero.
Minimal code to reproduce:
a = torch.ones((4,4))
b = torch.ones(4)
a@b
tensor([4., 4., 4., 4.])
a[[]]@b
>>>tensor([])
a[[]]@b.unsqueeze(-1)
Traceback (most recent call last):
File “”, line 1, in 
RuntimeError: invalid argument 13: ldc should be at least max(1, m=0), but have 0 at /pytorch/aten/src/TH/generic/THBlas.cpp:367