

def structured_dot(x, y):
    '\n    Structured Dot is like dot, except that only the\n    gradient wrt non-zero elements of the sparse matrix\n    `a` are calculated and propagated.\n\n    The output is presumed to be a dense matrix, and is represented by a\n    TensorType instance.\n\n    Parameters\n    ----------\n    a\n        A sparse matrix.\n    b\n        A sparse or dense matrix.\n\n    Returns\n    -------\n    A sparse matrix\n        The dot product of `a` and `b`.\n\n    Notes\n    -----\n    The grad implemented is structured.\n\n    '
    if hasattr(x, 'getnnz'):
        x = as_sparse_variable(x)
        assert (y.format in ['csr', 'csc'])
    if hasattr(y, 'getnnz'):
        y = as_sparse_variable(y)
        assert (y.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('structured_dot requires at least one sparse argument')
    if x_is_sparse_variable:
        return _structured_dot(x, y)
    else:
        assert y_is_sparse_variable
        return _structured_dot(y.T, x.T).T

dataset/ETHPy150Open rizar/attention-lvcsr/libs/Theano/theano/sparse/basic.py structured_dot/VarMisuse@33/243 `x`->`y`