提交 f210d812 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Copy/cast test values for scalar as well

I could not find a way of testing that code, since scalars are not well-supported by scan.
上级 511307f5
...@@ -64,6 +64,16 @@ def safe_new(x, tag='', dtype=None): ...@@ -64,6 +64,16 @@ def safe_new(x, tag='', dtype=None):
else: else:
nw_x = x.type() nw_x = x.type()
nw_x.name = nw_name nw_x.name = nw_name
if theano.config.compute_test_value != 'off':
# Copy test value, cast it if necessary
try:
x_test_value = gof.op.get_test_value(x)
except AttributeError:
# There is no test value
pass
else:
# This clause is executed if no exception was raised
nw_x.tag.test_value = nw_x.type.filter(x_test_value)
return nw_x return nw_x
else: else:
try: try:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论