提交 a521176e authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Added option to incsubtensor to disable warning, so as to be able to test it without this warning

上级 772c3563
...@@ -3039,8 +3039,11 @@ def setsubtensor(x, y, idx_list, inplace=False): ...@@ -3039,8 +3039,11 @@ def setsubtensor(x, y, idx_list, inplace=False):
print >> sys.stderr, "tensor.setsubtensor is deprecated - please use set_subtensor" print >> sys.stderr, "tensor.setsubtensor is deprecated - please use set_subtensor"
the_op = IncSubtensor(idx_list, inplace, set_instead_of_inc=True) the_op = IncSubtensor(idx_list, inplace, set_instead_of_inc=True)
return the_op(x, y, *Subtensor.collapse(idx_list, lambda entry: isinstance(entry, Variable))) return the_op(x, y, *Subtensor.collapse(idx_list, lambda entry: isinstance(entry, Variable)))
def incsubtensor(x, y, idx_list, inplace=False): def incsubtensor(x, y, idx_list, inplace=False, show_warning=True):
print >> sys.stderr, "tensor.incsubtensor is deprecated - please use inc_subtensor" # Note that `show_warning` should only be set to False by tests, in order
# to make sure this old code is still working.
if show_warning:
print >> sys.stderr, "tensor.incsubtensor is deprecated - please use inc_subtensor"
the_op = IncSubtensor(idx_list, inplace, set_instead_of_inc=False) the_op = IncSubtensor(idx_list, inplace, set_instead_of_inc=False)
return the_op(x, y, *Subtensor.collapse(idx_list, lambda entry: isinstance(entry, Variable))) return the_op(x, y, *Subtensor.collapse(idx_list, lambda entry: isinstance(entry, Variable)))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论