

def perform(self, node, inputs, outputs):
    (data, indices, indptr, shape) = inputs
    (out,) = outputs
    if (self.kmap is not None):
        data = data[self.kmap]
    if (len(shape) != 2):
        raise ValueError('Shape should be an array of length 2')
    if ((data.shape != indices.shape) and (numpy.size(data) != numpy.size(self.kmap))):
        errmsg = ((((((('Data (shape ' + repr(data.shape)) + ' must have the same number of elements ') + 'as indices (shape') + repr(indices.shape)) + ') or elements as kmap (') + repr(numpy.size(self.kmap))) + ')')
        raise ValueError(errmsg)
    if (self.format == 'csc'):
        out[0] = scipy.sparse.csc_matrix((data, indices.copy(), indptr.copy()), numpy.asarray(shape), copy=False)
    else:
        assert (self.format == 'csr')
        out[0] = scipy.sparse.csr_matrix((data, indices.copy(), indptr.copy()), shape.copy(), copy=False)

dataset/ETHPy150Open rizar/attention-lvcsr/libs/Theano/theano/sparse/basic.py CSM.perform/original