Skip to content

Commit

Permalink
bug/gmsd: Move gudhi import on top (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
zakajd authored Nov 9, 2020
1 parent 34a3d4a commit 4110265
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions piq/gs.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
from typing import Optional, Tuple
from multiprocessing import Pool

from scipy.spatial.distance import cdist

import torch
import gudhi
import numpy as np
from scipy.spatial.distance import cdist

from piq.base import BaseFeatureMetric

Expand Down Expand Up @@ -96,18 +96,6 @@ def witness(
Returns
A list of persistence intervals and the maximal persistence value.
"""
# Install gudhi only if needed
try:
import gudhi
except ImportError as e:
import six
error = e.__class__(
"You are likely missing your GUDHI installation, "
"you should visit http://gudhi.gforge.inria.fr/python/latest/installation.html "
"for further instructions.\nIf you use conda, you can use\nconda install -c conda-forge gudhi"
)
six.raise_from(error, e)

N = features.shape[0]
if gamma is None:
gamma = 1.0 / 128 * N / 5000
Expand Down

0 comments on commit 4110265

Please sign in to comment.