

def true_dot(x, y, grad_preserves_dense=True):
    '\n    Operation for efficiently calculating the dot product when\n    one or all operands are sparse. Supported formats are CSC and CSR.\n    The output of the operation is sparse.\n\n    Parameters\n    ----------\n    x\n        Sparse matrix.\n    y\n        Sparse matrix or 2d tensor variable.\n    grad_preserves_dense : bool\n        If True (default), makes the grad of dense inputs dense.\n        Otherwise the grad is always sparse.\n\n    Returns\n    -------\n    The dot product `x`.`y` in a sparse format.\n\n    Notex\n    -----\n    The grad implemented is regular, i.e. not structured.\n\n    '
    if hasattr(x, 'getnnz'):
        x = as_sparse_variable(x)
        assert (x.format in ['csr', 'csc'])
    if hasattr(y, 'getnnz'):
        y = as_sparse_variable(y)
        assert (x.format in ['csr', 'csc'])
    x_is_sparse_variable = _is_sparse_variable(x)
    y_is_sparse_variable = _is_sparse_variable(y)
    if ((not x_is_sparse_variable) and (not y_is_sparse_variable)):
        raise TypeError()
    if x_is_sparse_variable:
        return TrueDot(grad_preserves_dense)(x, y)
    else:
        assert y_is_sparse_variable
        return transpose(TrueDot(grad_preserves_dense)(y.T, x.T))

dataset/ETHPy150Open rizar/attention-lvcsr/libs/Theano/theano/sparse/basic.py true_dot/VarMisuse@68/319 `y`->`x`