code: def multi_dice_coef(y_true, y_pred, channels):
      def dice_coef(y_true, y_pred):
          dice_list = []
          for channel in range(channels):
              dice_list += [
                  dice_coef(y_true[..., channel], y_pred[..., channel])
              ]
  
          from keras.layers import Average
  
          return Average(dice_list)
  
      return dice_coef
  
imports: import numpy
  import itertools
label_desc: Use image node_id 4 for calling a global function with example usage: multi_dice_coef(y_true, y_pred, channels) and returns: dice_coef, Average