Solved by ptrblck in post #4 
              
              
                Thanks for the code! 
What is mymult applying internally (if you don’t want to share it due to research etc., it’s OK)? 
If you are using some PyTorch methods internally, they should be able to use tensors (or batches of tensors) instead of scalar values. 
On the other hand, if you are using some ot…