Solved by tom in post #4 
              
              
                Do try and if it doesn’t do what you want, print the shapes of the loss, weights, and targets and then we’ll see. 
Best regards 
Thoas