提交 7a61628f authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Brandon T. Willard

Fix comments in aesara.tensor.subtensor

上级 90f300ae
...@@ -809,7 +809,6 @@ class Subtensor(COp): ...@@ -809,7 +809,6 @@ class Subtensor(COp):
return rval return rval
def __hash__(self): def __hash__(self):
# TODO: optimize by cache this hash value
msg = [] msg = []
for entry in self.idx_list: for entry in self.idx_list:
if isinstance(entry, slice): if isinstance(entry, slice):
...@@ -2404,18 +2403,16 @@ class AdvancedIncSubtensor1(COp): ...@@ -2404,18 +2403,16 @@ class AdvancedIncSubtensor1(COp):
return (8,) return (8,)
def perform(self, node, inp, out_, params): def perform(self, node, inp, out_, params):
# TODO opt to make this inplace
x, y, idx = inp x, y, idx = inp
(out,) = out_ (out,) = out_
if not self.inplace: if not self.inplace:
x = x.copy() x = x.copy()
# In Numpy, x[idx] += y doesn't work if the same index is present
# many times: it does it only once. Is it a bug? In any case, for
# this reason we implement our own 'inc' iteration.
if self.set_instead_of_inc: if self.set_instead_of_inc:
x[idx] = y x[idx] = y
else: else:
# In Numpy, `x[idx] += y` doesn't work if the same index is present
# many times: it does it only once.
np.add.at(x, idx, y) np.add.at(x, idx, y)
out[0] = x out[0] = x
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论