Skip to content

since pot.emd2 returns accurate distance, how could the results have gradient when torch tensor passed in? #747

Description

@chansigit

i thought only sinkhorn methods enables gradient calculation due to iterative evaluation. how could EMD also support gradient calculation?

Activity

  1. rflamary commented on Aug 4, 2025

    @rflamary
    Collaborator

    It actually returns sub-gradients because indeed it is not differentiable but similarly to relu that is not differentiable, sub-gradient are quite sufficient for many optimization tasks (but less stable especially if you compute gradients wrt weights)

  2. locked and limited conversation to collaborators on Aug 13, 2025
  3. converted this issue into a discussion #750 on Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions