Solved by ptrblck in post #2 
              
              
                The weigths tensor should contain the weight for each sample in your dataset, nor the class weights only. 
Have a look at this example which shows a dummy use case.