Still no smarter person than @JuanFMontesinos replying, but I’m gray-haired enough to recommend Efficient computation of per-sample examples 171 and the discussion in issue #15359 50 for more inspiration.
Best regards
Thomas