mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-06 05:16:40 +08:00
fix numpy 1.6 compatibility
This commit is contained in:
committed by
Gregory R. Lee
parent
2d326a464e
commit
c2b86d8a02
@@ -175,7 +175,12 @@ def _denoise_tv_chambolle_nd(im, weight=0.2, eps=2.e-4, n_iter_max=200):
|
||||
g[slices_g] = np.diff(out, axis=ax)
|
||||
slices_g[ax] = slice(None)
|
||||
|
||||
norm = np.sqrt((g*g).sum(-1, keepdims=True))
|
||||
try:
|
||||
norm = np.sqrt((g*g).sum(-1, keepdims=True))
|
||||
except:
|
||||
# no keepdims argument available prior to numpy 1.7
|
||||
norm = np.sqrt((g*g).sum(-1))[..., np.newaxis]
|
||||
|
||||
E += weight * norm.sum()
|
||||
norm *= 0.5 / weight
|
||||
norm += 1.
|
||||
|
||||
Reference in New Issue
Block a user