

def grad(self, inputs, outputs_gradients):
    gz = outputs_gradients[0]
    if (gz.dtype in complex_dtypes):
        raise NotImplementedError('grad not implemented for complex types')
    if (inputs[0].dtype in complex_dtypes):
        raise NotImplementedError('grad not implemented for complex types')
    if (gz.dtype in discrete_dtypes):
        if (inputs[0].dtype in discrete_dtypes):
            return [inputs[0].zeros_like(dtype=theano.config.floatX)]
        else:
            return [inputs[0].zeros_like()]
    elif (inputs[0].dtype in discrete_dtypes):
        return [gz]
    else:
        return [Cast(inputs[0].dtype)(gz)]

dataset/ETHPy150Open rizar/attention-lvcsr/libs/Theano/theano/sparse/basic.py Cast.grad/original