Skip to content

Commit

Permalink
Suppress Numpy run time errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Hao-Wen Dong authored Nov 2, 2018
1 parent 26d14f9 commit f2daaf1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions v2/musegan/utils/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,11 @@ def tonal_dist(chroma1, chroma2, tonal_matrix=None):
tonal_matrix = get_tonal_matrix()
warnings.warn("`tonal matrix` not specified. Use default tonal matrix",
RuntimeWarning)
chroma1 = chroma1 / np.sum(chroma1)
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=RuntimeWarning)
chroma1 = chroma1 / np.sum(chroma1)
chroma2 = chroma2 / np.sum(chroma2)
result1 = np.matmul(tonal_matrix, chroma1)
chroma2 = chroma2 / np.sum(chroma2)
result2 = np.matmul(tonal_matrix, chroma2)
return np.linalg.norm(result1 - result2)

Expand Down

0 comments on commit f2daaf1

Please sign in to comment.