提交 1db17057 authored 作者: Frederic's avatar Frederic

small code simplification.

上级 0fae9d8b
...@@ -4292,19 +4292,15 @@ def inc_subtensor(x, y, inplace=False, set_instead_of_inc=False, ...@@ -4292,19 +4292,15 @@ def inc_subtensor(x, y, inplace=False, set_instead_of_inc=False,
elif isinstance(x.owner.op, AdvancedSubtensor1): elif isinstance(x.owner.op, AdvancedSubtensor1):
real_x = x.owner.inputs[0] real_x = x.owner.inputs[0]
ilist = x.owner.inputs[1] ilist = x.owner.inputs[1]
if set_instead_of_inc: the_op = AdvancedIncSubtensor1(inplace,
the_op = AdvancedIncSubtensor1(inplace, set_instead_of_inc=True) set_instead_of_inc=set_instead_of_inc)
else:
the_op = AdvancedIncSubtensor1(inplace, set_instead_of_inc=False)
return the_op(real_x, y, ilist) return the_op(real_x, y, ilist)
elif isinstance(x.owner.op, AdvancedSubtensor): elif isinstance(x.owner.op, AdvancedSubtensor):
real_x = x.owner.inputs[0] real_x = x.owner.inputs[0]
coordvec_0 = x.owner.inputs[1] coordvec_0 = x.owner.inputs[1]
coordvec_1 = x.owner.inputs[2] coordvec_1 = x.owner.inputs[2]
if set_instead_of_inc: the_op = AdvancedIncSubtensor(inplace,
the_op = AdvancedIncSubtensor(inplace, set_instead_of_inc=True) set_instead_of_inc=set_instead_of_inc)
else:
the_op = AdvancedIncSubtensor(inplace, set_instead_of_inc=False)
return the_op(real_x, y, coordvec_0, coordvec_1) return the_op(real_x, y, coordvec_0, coordvec_1)
else: else:
raise TypeError('x must be result of a subtensor operation') raise TypeError('x must be result of a subtensor operation')
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论