Correct me if I’m wrong, but as I understand it, you’re looking for a way to have a loss function (something like CrossEntropy loss) weigh each instance separately. I’m currently working on something 331 that will have loss functions return a loss per instance, so you can apply weights to these losses and sum them together yourself.
If you want to implement an instance-weighted loss, I think you’d have to re-implement a loss.