提交 ba551663 authored 作者: Nicolas Ballas's avatar Nicolas Ballas

Catch scipy related complex warning

上级 e563c53c
...@@ -10,6 +10,7 @@ from theano.gof import Apply, Op ...@@ -10,6 +10,7 @@ from theano.gof import Apply, Op
from six.moves import xrange from six.moves import xrange
import warnings
import numpy import numpy
try: try:
from scipy.signal.signaltools import _valfrommode, _bvalfromboundary from scipy.signal.signaltools import _valfrommode, _bvalfromboundary
...@@ -458,12 +459,16 @@ class BaseAbstractConv2d(Op): ...@@ -458,12 +459,16 @@ class BaseAbstractConv2d(Op):
out = numpy.zeros(out_shape, dtype=img.dtype) out = numpy.zeros(out_shape, dtype=img.dtype)
val = _valfrommode(mode) val = _valfrommode(mode)
bval = _bvalfromboundary('fill') bval = _bvalfromboundary('fill')
for b in xrange(img.shape[0]):
for n in xrange(kern.shape[0]): with warnings.catch_warnings():
for im0 in xrange(img.shape[1]): warnings.simplefilter('ignore', numpy.ComplexWarning)
out[b, n, ...] += _convolve2d(img[b, im0, ...], for b in xrange(img.shape[0]):
kern[n, im0, ...], for n in xrange(kern.shape[0]):
1, val, bval, 0) for im0 in xrange(img.shape[1]):
# some cast generates a warning here
out[b, n, ...] += _convolve2d(img[b, im0, ...],
kern[n, im0, ...],
1, val, bval, 0)
return out return out
......
...@@ -794,13 +794,16 @@ class ConvOp(OpenMPOp): ...@@ -794,13 +794,16 @@ class ConvOp(OpenMPOp):
val = _valfrommode(self.out_mode) val = _valfrommode(self.out_mode)
bval = _bvalfromboundary('fill') bval = _bvalfromboundary('fill')
for b in xrange(bsize): with warnings.catch_warnings():
for n in xrange(nkern): warnings.simplefilter('ignore', numpy.ComplexWarning)
zz[b, n, ...].fill(0) for b in xrange(bsize):
for im0 in xrange(stacklen): for n in xrange(nkern):
zz[b, n, ...] += _convolve2d(img2d[b, im0, ...], zz[b, n, ...].fill(0)
filtersflipped[n, im0, ...], for im0 in xrange(stacklen):
1, val, bval, 0) # some cast generates a warning here
zz[b, n, ...] += _convolve2d(img2d[b, im0, ...],
filtersflipped[n, im0, ...],
1, val, bval, 0)
if False: if False:
if False and self.out_mode == "full": if False and self.out_mode == "full":
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论