提交 ed222a6d authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Don't autocast to float16 unless config.floatX == 'float16'

上级 1a4a1c96
...@@ -281,7 +281,11 @@ class NumpyAutocaster(object): ...@@ -281,7 +281,11 @@ class NumpyAutocaster(object):
config.floatX != 'float64')): config.floatX != 'float64')):
return theano._asarray(x, dtype=config.floatX) return theano._asarray(x, dtype=config.floatX)
for dtype in self.dtypes: # Don't autocast to float16 unless config.floatX is float16
try_dtypes = [d for d in self.dtypes
if config.floatX == 'float16' or d != 'float16']
for dtype in try_dtypes:
x_ = theano._asarray(x, dtype=dtype) x_ = theano._asarray(x, dtype=dtype)
if numpy.all(x == x_): if numpy.all(x == x_):
break break
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论