* fixed csm gradient to work with no kernel map

@TODO: this whole kernel map thing should've probably been implemented as its own op, which would sit between the kernel taps and the CSM op (a "Shuffle" or "TensorView" op). Revisit at a later date
上级 9121085f
......@@ -323,9 +323,12 @@ class CSMGrad(gof.op.Op):
return gof.Apply(self, [data, gout_data, gout_indices], [g_data])
def perform(self, node, (data, gout_data, gout_indices), (g_data,)):
grad = numpy.zeros_like(data)
grad[self.map] = gout_data
g_data[0] = grad
if self.map is None:
g_data[0] = gout_data
else:
grad = numpy.zeros_like(data)
grad[self.map] = gout_data
g_data[0] = grad
csm_grad = CSMGrad
@gof.local_optimizer([csm_properties])
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论