Replace all the softmax cross-entropy loss computation with the following line:
loss = tf.reduce_mean(gamma * rex + hyz)