Solved by KFrank in post #2 
              
              
                Hey Nay! 

I don’t really understand your overall use case – “test utterance,” 
applying the model to a distance matrix – so I don’t have any 
thoughts on your “real” problem 
Three lower-level comments: 
Your code for loss looks sensible and correct.  (I’ll leave it up to 
you as to whether at the …