

def make_node(self, data, indices, indptr, shape):
    data = tensor.as_tensor_variable(data)
    if (not isinstance(indices, gof.Variable)):
        indices_ = numpy.asarray(indices)
        indices_32 = theano._asarray(indices, dtype='int32')
        assert (indices_ == indices_32).all()
        indices = indices_32
    if (not isinstance(indptr, gof.Variable)):
        indptr_ = numpy.asarray(indptr)
        indptr_32 = theano._asarray(indptr, dtype='int32')
        assert (indptr_ == indptr_32).all()
        indptr = indptr_32
    if (not isinstance(shape, gof.Variable)):
        shape_ = numpy.asarray(shape)
        shape_32 = theano._asarray(shape, dtype='int32')
        assert (shape_ == shape_32).all()
        shape = shape_32
    indices = tensor.as_tensor_variable(indices)
    indptr = tensor.as_tensor_variable(indptr)
    shape = tensor.as_tensor_variable(shape)
    if (data.type.ndim != 1):
        raise TypeError('data argument must be a vector', data.type, data.type.ndim)
    if ((indices.type.ndim != 1) or (indices.type.dtype not in discrete_dtypes)):
        raise TypeError('indices must be vector of integers', indices, indices.type)
    if ((indptr.type.ndim != 1) or (indptr.type.dtype not in discrete_dtypes)):
        raise TypeError('indices must be vector of integers', indptr, indptr.type)
    if ((shape.type.ndim != 1) or (shape.type.dtype not in discrete_dtypes)):
        raise TypeError('n_rows must be integer type', shape, shape.type)
    return gof.Apply(self, [data, indices, indptr, shape], [SparseType(dtype=data.type.dtype, format=self.format)()])

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