diff options
author | Zachary Kurtz <zdkurtz@gmail.com> | 2022-05-16 03:54:08 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-16 09:54:08 +0200 |
commit | 951209ac3f01c86b35d3beff4679ce47e47c0872 (patch) | |
tree | abae42cd5f682e750e40f99aa35180625de8e990 | |
parent | b001d7a15676ead5d9b38d57609fd390c3749f81 (diff) |
[MRG] dist: check metric is a string before calling a str method (#379)
-rw-r--r-- | ot/utils.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ot/utils.py b/ot/utils.py index a23ce7e..57fb4a4 100644 --- a/ot/utils.py +++ b/ot/utils.py @@ -232,7 +232,7 @@ def dist(x1, x2=None, metric='sqeuclidean', p=2, w=None): if not get_backend(x1, x2).__name__ == 'numpy': raise NotImplementedError() else: - if metric.endswith("minkowski"): + if isinstance(metric, str) and metric.endswith("minkowski"): return cdist(x1, x2, metric=metric, p=p, w=w) return cdist(x1, x2, metric=metric, w=w) |