code: def rmse_consistency(pred_ave, pred_multi, weight_map=None):
      pred_multi = tf.nn.softmax(pred_multi, -1)
      pred_multi_ave = tf.reduce_mean(pred_multi, axis=1)
      pred_multi_ave = tf.Print(
          tf.cast(pred_multi_ave, tf.float32),
          [
              pred_ave[0],
              pred_multi_ave[0],
              tf.shape(pred_ave),
              tf.shape(pred_multi_ave),
              tf.reduce_max(pred_ave - pred_multi_ave),
          ],
          message="rmse_test",
      )
      diff_square = tf.square(pred_ave - pred_multi_ave)
      if weight_map is not None:
          diff_square = tf.multiply(
              weight_map, diff_square
          ) / tf.reduce_sum(weight_map)
  
      return tf.sqrt(tf.reduce_mean(diff_square))
  
file_path: NiftyNet/niftynet/layer/loss_classification_multi.py
imports: from __future__ import absolute_import, print_function, division
  import numpy
  import tensorflow
  from niftynet.engine.application_factory import LossClassificationMultiFactory
  from niftynet.layer.base_layer import Layer
label_desc: Use image node_id 5 for calling a global function with example usage: rmse_consistency(pred_ave, pred_multi, weight_map) and returns: tf