Warning about `ValFunction` instantiation when using POT with PyTorch

Describe the bug

With PyTorch 1.10.1+cu102, using OT on a tensor with a gradient, the following warning message is raised:

[....] valfunction should not be instantiated. Methods on autograd functions are all static, so you should
invoke them on the class itself. Instantiating an autograd function will raise an error in a future version
of PyTorch.

To Reproduce

Steps to reproduce the behavior:

  1. Create tensor with gradient
  2. Use POT function that uses ValFunction from backend.
  3. See warning being raised.

Expected behavior

Warning should not be raised

Environment

  • OS: Linux
  • Python version: 3.9.9
  • How was POT installed (source, pip, conda): poetry (pip + virtualenv)

Output of the following code snippet:

import platform; print(platform.platform())
import sys; print("Python", sys.version)
import numpy; print("NumPy", numpy.__version__)
import scipy; print("SciPy", scipy.__version__)
import ot; print("POT", ot.__version__)
Linux-5.16.1-arch1-1-x86_64-with-glibc2.33
Python 3.9.9 (main, Dec 17 2021, 20:04:17) 
[GCC 11.1.0]
NumPy 1.22.1
SciPy 1.7.3
POT 0.8.1.0

Additional context

PR is being prepared to address this issue.