Solved by ptrblck in post #2 
              
              
                The weights tensor should contain a weight for each sample, not the class weights. 
Have a look at this post for an example.