scenic icon indicating copy to clipboard operation
scenic copied to clipboard

Unknown term in `sample_permutation` for sinkhorn

Open MasterSkepticista opened this issue 1 year ago • 1 comments

Hi, I am trying to use sinkhorn matcher for batch sizes >8 (per device) as in the code. It (understandably) fails at #L62 since bs * dim exceeds sampling range available 10 * dim.

ValueError: Cannot take a larger sample than population when 'replace=False'

https://github.com/google-research/scenic/blob/1dc7352d1dec0ce4e13e2252f50d14082ca373e0/scenic/model_lib/matchers/sinkhorn.py#L62-L63

I could replace 10 with bs or higher to get it to work. I have few questions though:

  • Is 10 arbitrary?
  • Why is 10 multiplied to the sorted vector in #L63? Could you point me to the relevant literature (incl for previous) if this is a specific choice?
  • If 10 is arbitrary, can I replace 10 -> bs in both #L62 and #L63 while maintaining algorithmic correctness?

MasterSkepticista avatar May 13 '24 15:05 MasterSkepticista

Could you please cite the source? This otherwise feels like an AI-generated answer.

MasterSkepticista avatar May 14 '24 04:05 MasterSkepticista