code: def tf_solve_upper_triangular_masked_kron(L, y, mask):
      """Tensorflow function to solve L^T x = y
      where L = kron(L[0], L[1] .. L[n-1])
      and L[i] are the lower triangular matrices
  
      Arguments
      ---------
      L : list of 2-D tensors
          Each element of the list must be a tensorflow tensor and
          must be a lower triangular matrix of dimension n_i x n_i
  
      y : 1-D or 2-D tensor
          Dimension [n_0*n_1*..n_(m-1)), p]
  
      mask: 1-D tensor
          Dimension [n_0*n_1*...n_(m-1)] with 1 for valid rows
          and 0 for don't care
  
      Returns
      -------
      x : 1-D or 2-D tensor
          Dimension (n_0*n_1*..n_(m-1)) x p, values at rows
          for which mask == 0 are set to zero
  
      """
      n = len(L)
      if n == 1:
          return tf_masked_triangular_solve(
              L[0], y, mask, lower=True, adjoint=True
          )
      else:
          x = y
          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]
          L1_end_tr = [tf.transpose(a=x) for x in L[1:]]
  
          for i in range(na - 1, -1, -1):
              mask_b = tf.slice(mask, [i * nb], [nb])
              xt, xinb, xina = tf.split(
                  x, [i * nb, nb, (na - i - 1) * nb], 0
              )
              t = xinb / L[0][i, i]
  
              if tf.reduce_sum(input_tensor=mask_b) != nb:
                  xinb = tf_solve_upper_triangular_masked_kron(
                      L[1:], t, mask_b
                  )
                  t_masked = tf_kron_mult(L1_end_tr, xinb)
              else:
                  xinb = tf_solve_upper_triangular_kron(L[1:], t)
                  t_masked = t
  
              xt = xt - tf.reshape(
                  tf.tile(
                      tf.transpose(a=tf.slice(L[0], [i, 0], [1, i])),
                      [1, nb * col],
                  ),
                  [i * nb, col],
              ) * tf.reshape(
                  tf.tile(tf.reshape(t_masked, [-1, 1]), [i, 1]),
                  [i * nb, col],
              )
              x = tf.concat(axis=0, values=[xt, xinb, xina])
  
          return x
  
imports: import tensorflow
label_desc: Use image node_id 6 for calling a global function with example usage: tf_solve_upper_triangular_masked_kron(L, y, mask) and returns: tf_masked_triangular_solve, x