Solved by albanD in post #2 
              
              
                From the error mesage, it is a size issue on the 3rd dimension, where one is of size 8 and the other of size 9. 
I would print the size of the tensors before the operation to check the dimensions.