

def as_sparse_variable(x, name=None):
    '\n    Wrapper around SparseVariable constructor to construct\n    a Variable with a sparse matrix with the same dtype and\n    format.\n\n    Parameters\n    ----------\n    x\n        A sparse matrix.\n\n    Returns\n    -------\n    object\n        SparseVariable version of `x`.\n\n    '
    if isinstance(x, gof.Apply):
        if (len(x.outputs) != 1):
            raise ValueError('It is ambiguous which output of a multi-output Op has to be fetched.', x)
        else:
            x = x.outputs[0]
    if isinstance(x, gof.Variable):
        if (not isinstance(x.type, SparseType)):
            raise TypeError('Variable type field must be a SparseType.', name, x.type)
        return x
    try:
        return constant(x, name=name)
    except TypeError:
        raise TypeError(('Cannot convert %s to SparseType' % x), type(x))

dataset/ETHPy150Open rizar/attention-lvcsr/libs/Theano/theano/sparse/basic.py as_sparse_variable/VarMisuse@98/253 `x`->`name`