def grad(self, inputs, gout):
(x, y) = inputs
(gz,) = gout
z = self(x, y)
if z.type.dtype in discrete_types:
# The gradient does not flow in if the output is discrete
return [x.zeros_like(dtype=theano.config.floatX),
y.zeros_like(dtype=theano.config.floatX)]
return [gz,
-(x // y) * gz]
评论列表
文章目录