Keras: do `sample weights` take part in the derivatives
sample_weights affect the total_loss, which is used to calculate the gradients.


  Because the loss function is not actually defined based on the sample weights, its rather passed in (as an argument) to the fit function in Keras


I think that what you're missing is that the loss function actually returns a list of loss values (one per sample in the batch). This is precisely because during fit, it is multiplied by the sample_weight of that batch.

Please note that although "class based" losses support reduction (over the batch), the Loss base class implements the weighting during reduction.