

def grad(self, inputs, gout):
    (x, y) = inputs
    (gz,) = gout
    assert (_is_sparse_variable(x) or _is_sparse_variable(y))
    rval = []
    if _is_dense_variable(y):
        rval.append(tensor.dot(gz, y.T))
    else:
        rval.append(dot(gz, y.T))
    if _is_dense_variable(x):
        rval.append(tensor.dot(x.T, gz))
    else:
        rval.append(dot(x.T, gz))
    return rval

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