提交 d965c26b authored 作者: Tanjay94's avatar Tanjay94

Added float64 warning to TensorVariable class.

上级 1e51644a
...@@ -24,6 +24,11 @@ AddConfigVar('floatX', ...@@ -24,6 +24,11 @@ AddConfigVar('floatX',
EnumStr('float64', 'float32', convert=floatX_convert,), EnumStr('float64', 'float32', convert=floatX_convert,),
) )
AddConfigVar('warn_float64',
"Warning for float64 output",
BoolParam(False)
)
AddConfigVar('cast_policy', AddConfigVar('cast_policy',
"Rules for implicit type casting", "Rules for implicit type casting",
EnumStr('custom', 'numpy+floatX', EnumStr('custom', 'numpy+floatX',
......
...@@ -574,6 +574,14 @@ class _tensor_py_operators: ...@@ -574,6 +574,14 @@ class _tensor_py_operators:
class TensorVariable(_tensor_py_operators, Variable): class TensorVariable(_tensor_py_operators, Variable):
"""Subclass to add the tensor operators to the basic `Variable` class.""" """Subclass to add the tensor operators to the basic `Variable` class."""
def __init__(self, type)
if (config.warn_float64 and type = float64):
print '''Warning, you are instanciating parts of your graph
with the float64 type (possibly by accident).
This means that those parts will not run on the GPU.
If that is what you want, you can disable this warning by
setting warn_float64=False in your theano flags.'''
TensorType.Variable = TensorVariable TensorType.Variable = TensorVariable
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论