code: def tf_kron_mult(L, x):
      """Tensorflow multiply with kronecker product matrix
      Returns kron(L[0], L[1] ...) * x
  
      Arguments
      ---------
      L : list of 2-D tensors
          Each element of the list must be a tensorflow tensor and
          must be a square matrix of dimension n_i x n_i
  
      x : 1-D or 2-D tensor
          Dimension (n_0*n_1*..n_(m-1)) x p
  
      Returns
      -------
      y : 1-D or 2-D tensor
          Dimension (n_0*n_1*..n_(m-1)) x p
      """
      n = len(L)
      if n == 1:
          return tf.matmul(L[0], x)
      else:
          na = L[0].get_shape().as_list()[0]
          n_list = tf.stack(
              [
                  tf.cast(tf.shape(input=mat)[0], dtype=tf.float64)
                  for mat in L
              ]
          )
          n_prod = tf.cast(
              tf.reduce_prod(input_tensor=n_list), dtype=tf.int32
          )
          nb = tf.cast(n_prod / na, dtype=tf.int32)
          col = tf.shape(input=x)[1]
          xt = tf_kron_mult(
              L[1:],
              tf.transpose(a=tf.reshape(tf.transpose(a=x), [-1, nb])),
          )
          y = tf.zeros_like(x)
          for i in range(na):
              ya, yb, yc = tf.split(
                  y, [i * nb, nb, (na - i - 1) * nb], 0
              )
              yb = tf.reshape(
                  tf.matmul(
                      tf.reshape(xt, [nb * col, na]),
                      tf.transpose(a=tf.slice(L[0], [i, 0], [1, na])),
                  ),
                  [nb, col],
              )
              y = tf.concat(axis=0, values=[ya, yb, yc])
          return y
  
imports: import tensorflow
label_desc: Use image node_id 3 for calling a global function with example usage: tf_kron_mult(L, x) and returns: tf, y