提交 588a9869 authored 作者: Ian Goodfellow's avatar Ian Goodfellow

fixed bug where ifelse rejected sparse types

上级 140d61b7
...@@ -314,8 +314,10 @@ def ifelse(condition, then_branch, else_branch, name=None): ...@@ -314,8 +314,10 @@ def ifelse(condition, then_branch, else_branch, name=None):
for then_branch_elem, else_branch_elem in zip(then_branch, else_branch): for then_branch_elem, else_branch_elem in zip(then_branch, else_branch):
then_branch_elem = theano.tensor.as_tensor_variable(then_branch_elem) if not isinstance(then_branch_elem, theano.Variable):
else_branch_elem = theano.tensor.as_tensor_variable(else_branch_elem) then_branch_elem = theano.tensor.as_tensor_variable(then_branch_elem)
if not isinstance(else_branch_elem, theano.Variable):
else_branch_elem = theano.tensor.as_tensor_variable(else_branch_elem)
if then_branch_elem.type != else_branch_elem.type: if then_branch_elem.type != else_branch_elem.type:
raise ValueError(('The two branches should have identical types, ' raise ValueError(('The two branches should have identical types, '
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论