def bound(x): bound = tf.maximum(tf.sqrt(tf.mul(tf.real(x), tf.real(x)) \ + tf.mul(tf.imag(x), tf.imag(x))), 1.0) return tf.complex(tf.real(x) / bound, tf.imag(x) / bound)