

def make_node(self, x, y):
    dtype_out = scalar.upcast(x.dtype, y.dtype)
    if isinstance(x, scipy.sparse.spmatrix):
        x = as_sparse_variable(x)
    if isinstance(y, scipy.sparse.spmatrix):
        y = as_sparse_variable(y)
    x_is_sparse_var = _is_sparse_variable(x)
    y_is_sparse_var = _is_sparse_variable(y)
    if ((not x_is_sparse_var) and (not y_is_sparse_var)):
        raise TypeError(('Sparse dot product should have at least one sparse variable as inputs, but the inputs are %s (%s) and %s (%s).' % (x, x.type, y, y.type)))
    if (not x_is_sparse_var):
        x = tensor.as_tensor_variable(x)
        assert (y.format in ['csr', 'csc'])
        if (x.ndim not in (1, 2)):
            raise TypeError(('theano.sparse.Dot: input 0 (0-indexed) must have ndim of 1 or 2, %d given.' % x.ndim))
    if (not y_is_sparse_var):
        y = tensor.as_tensor_variable(y)
        assert (x.format in ['csr', 'csc'])
        if (y.ndim not in (1, 2)):
            raise TypeError(('theano.sparse.Dot: input 1 (1-indexed) must have ndim of 1 or 2, %d given.' % y.ndim))
    if ((y.ndim == 1) or (x.ndim == 1)):
        bz = (False,)
    else:
        bz = (False, False)
    return gof.Apply(self, [x, y], [tensor.tensor(dtype=dtype_out, broadcastable=bz)])

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