提交 65455758 authored 作者: Frederic's avatar Frederic

Do not call as_tensor_variable on other Theano variable.

上级 f1fa6737
...@@ -638,8 +638,11 @@ def get_test_value(v): ...@@ -638,8 +638,11 @@ def get_test_value(v):
For a Shared variable, it is the internal value. For a Shared variable, it is the internal value.
For another Variable, it is the content of v.tag.test_value. For another Variable, it is the content of v.tag.test_value.
""" """
v_tensor = theano.tensor.as_tensor_variable(v) if not isinstance(v, graph.Variable):
return PureOp._get_test_value(v_tensor) v_var = theano.tensor.as_tensor_variable(v)
else:
v_var = v
return PureOp._get_test_value(v_var)
def missing_test_message(msg): def missing_test_message(msg):
......
...@@ -548,7 +548,7 @@ class MergeOptimizer(Optimizer): ...@@ -548,7 +548,7 @@ class MergeOptimizer(Optimizer):
except InconsistencyError: except InconsistencyError:
success = False success = False
fgraph.merge_feature.blacklist.append( fgraph.merge_feature.blacklist.append(
(pairs[0][0].owner, pairs[0][1].owner)) (pairs[0][0].owner, pairs[0][1].owner))
if success: if success:
break break
...@@ -1027,7 +1027,7 @@ class PatternSub(LocalOptimizer): ...@@ -1027,7 +1027,7 @@ class PatternSub(LocalOptimizer):
else: else:
return pattern.clone() return pattern.clone()
u = match(self.in_pattern, node.out, unify.Unification(), True, u = match(self.in_pattern, node.out, unify.Unification(), True,
self.pdb) self.pdb)
if u: if u:
p = self.out_pattern p = self.out_pattern
new = build(p, u) new = build(p, u)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论