def get_init_np():
    """Initializer function for multihead 1x1 parameters using numpy."""
    results = []
    for _ in range(n_1x1_heads):
      random_matrix = np.random.rand(n_channels, n_channels)
      np_w = scipy.linalg.qr(random_matrix)[0].astype("float32")
      np_p, np_l, np_u = scipy.linalg.lu(np_w)
      np_s = np.diag(np_u)
      np_sign_s = np.sign(np_s)[np.newaxis, :]
      np_log_s = np.log(np.abs(np_s))[np.newaxis, :]
      np_u = np.triu(np_u, k=1)
      results.append(
          np.concatenate([np_p, np_l, np_u, np_sign_s, np_log_s], axis=0))
    return tf.convert_to_tensor(np.stack(results, axis=0))
Initializer function for multihead 1x1 parameters using numpy.
tensor2tensor/layers/transformer_glow_layers.py