

def add(x, y):
    '\n    Add two matrices, at least one of which is sparse.\n\n    This method will provide the right op according\n    to the inputs.\n\n    Parameters\n    ----------\n    x\n        A matrix variable.\n    y\n        A matrix variable.\n\n    Returns\n    -------\n    A sparse matrix\n        `x` + `y`\n\n    Notes\n    -----\n    At least one of `x` and `y` must be a sparse matrix.\n\n    The grad will be structured only when one of the variable will be a dense\n    matrix.\n\n    '
    if hasattr(x, 'getnnz'):
        x = as_sparse_variable(x)
    if hasattr(y, 'getnnz'):
        y = as_sparse_variable(y)
    if (not isinstance(x, theano.Variable)):
        x = theano.tensor.as_tensor_variable(x)
    if (not isinstance(y, theano.Variable)):
        y = theano.tensor.as_tensor_variable(y)
    x_is_sparse_variable = _is_sparse_variable(x)
    y_is_sparse_variable = _is_sparse_variable(y)
    assert (y or y_is_sparse_variable)
    if (x_is_sparse_variable and y_is_sparse_variable):
        return add_s_s(x, y)
    elif (x_is_sparse_variable and (not y_is_sparse_variable)):
        return add_s_d(x, y)
    elif (y_is_sparse_variable and (not x_is_sparse_variable)):
        return add_s_d(y, x)
    else:
        raise NotImplementedError()

dataset/ETHPy150Open rizar/attention-lvcsr/libs/Theano/theano/sparse/basic.py add/VarMisuse@120/354 `x_is_sparse_variable`->`y`