We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
callable
According to the docstring of ot.dist, the metric object can be be a callable function.
However, L235 clearly expects [only] a string.
Looks like this was broken in commit 0c5899
Steps to reproduce the behavior:
import ot import numpy as np n = 10 a = np.random.randn(n,3) b = np.random.randn(n,3) eucl = lambda a, b: np.sum(np.square(a - b)) ot.dist(a, b, metric = eucl)
bug:
if metric.endswith("minkowski"): AttributeError: 'function' object has no attribute 'endswith'
Output of the following code snippet:
import ot; print("POT", ot.__version__) # POT 0.8.2
The text was updated successfully, but these errors were encountered:
Hello @zdk123
Indeed this is a bug, we should just test if metric is a string before with if type(metric)==str and metric.endswith("minkowski"):
if type(metric)==str and metric.endswith("minkowski"):
Could you do a quick PR with this?
Sorry, something went wrong.
sure!
Successfully merging a pull request may close this issue.
Describe the bug
According to the docstring of ot.dist, the metric object can be be a callable function.
However, L235 clearly expects [only] a string.
Looks like this was broken in commit 0c5899
To Reproduce
Steps to reproduce the behavior:
bug:
Output of the following code snippet:
The text was updated successfully, but these errors were encountered: