import tensorflow as tf

                    update_mean = moving_averages.assign_moving_average(moving_mean, mean, decay)
                    update_variance = moving_averages.assign_moving_average(moving_variance, variance, decay)
                    with tf.control_dependencies([update_mean, update_variance]):
                        X = tf.identity(X)
                else:
                    # For prediction, do batch norm with computed moving mean & variance from training
                    # Don't update moving averages if predicting
                    (X, _, _) =  tf.nn.fused_batch_norm(X, scale, offset, mean=moving_mean, variance=moving_variance,
                                                            epsilon=epsilon, is_training=False)
            else:
                (X, _, _) =  tf.nn.fused_batch_norm(X, scale, offset, epsilon=epsilon, is_training=True)

            return X

    def _mark_for_monitoring(self, name, value):
        tf.add_to_collection(TF_COLLECTION_MONITORED, tf.identity(value, name))

    def _add_monitoring_of_values(self):
        monitored_values = tf.get_collection(TF_COLLECTION_MONITORED)
        monitored_values = {
