提交 27caa4e5 authored 作者: James Bergstra's avatar James Bergstra

added dummy grad fn to AdvancedSubtensor1

上级 b927a1b1
......@@ -3354,11 +3354,21 @@ class AdvancedSubtensor1(Op):
# the caller should have made a copy of x len(ilist) times
raise TypeError('cannot index into a broadcastable dimension')
return gof.Apply(self, [x_, ilist_], [x_.type()])
return Apply(self, [x_, ilist_], [x_.type()])
def perform(self, node, (x,i), (out,)):
out[0] = x[i]
def grad(self, inputs, (gz,)):
class NotImplementedOp(Op):
# This op should be pruned from the graph.
# This Op can be created in a graph,
# but it will cause problems if one of your parameters actually depends on it!
def make_node(self, *args):
return Apply(self, args, [inputs[0].type()])
return [NotImplementedOp()(gz)]+[None]*(len(inputs)-1)
class AdvancedSubtensor(Op):
"""Return a subtensor copy, using advanced indexing.
"""
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论