(D, dtype=tf.float32)
return tensor_1xDxD
Create a upper triangle matrix for decoding bias.
Create a upper triangle matrix for decoding bias.
Create a upper triangle matrix for decoding bias .
def upper_triangle_bias(D, dtype=tf.float32):
  """Create a upper triangle matrix for decoding bias."""
  upper_triangle_DxD = 1 - tf.matrix_band_part(
      tf.ones([D, D], dtype=dtype), -1, 0)
  tensor_1xDxD = tf.expand_dims(upper_triangle_DxD * dtype.min, axis=0)
  return tensor_1xDxD
def upper_triangle_bias ( D , dtype = tf . float32 ) : upper_triangle_DxD = 1 - tf . matrix_band_part ( tf . ones ( [ D , D ] , dtype = dtype ) , - 1 , 0 ) tensor_1xDxD = tf . expand_dims ( upper_triangle_DxD * dtype . min , axis = 0 ) return tensor_1xDxD