Skip to content

Commit 4110265

Browse files
authored
bug/gmsd: Move gudhi import on top (#182)
1 parent 34a3d4a commit 4110265

1 file changed

Lines changed: 2 additions & 14 deletions

File tree

piq/gs.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
from typing import Optional, Tuple
88
from multiprocessing import Pool
99

10-
from scipy.spatial.distance import cdist
11-
1210
import torch
11+
import gudhi
1312
import numpy as np
13+
from scipy.spatial.distance import cdist
1414

1515
from piq.base import BaseFeatureMetric
1616

@@ -96,18 +96,6 @@ def witness(
9696
Returns
9797
A list of persistence intervals and the maximal persistence value.
9898
"""
99-
# Install gudhi only if needed
100-
try:
101-
import gudhi
102-
except ImportError as e:
103-
import six
104-
error = e.__class__(
105-
"You are likely missing your GUDHI installation, "
106-
"you should visit http://gudhi.gforge.inria.fr/python/latest/installation.html "
107-
"for further instructions.\nIf you use conda, you can use\nconda install -c conda-forge gudhi"
108-
)
109-
six.raise_from(error, e)
110-
11199
N = features.shape[0]
112100
if gamma is None:
113101
gamma = 1.0 / 128 * N / 5000

0 commit comments

Comments
 (0)