code: def minibatch_state_concat(input_tensor, averaging="all", dim=2):
      vals = adjusted_std(input_tensor, axis=0, keepdims=True)
  
      if averaging == "all":
          vals = tf.reduce_mean(vals, keepdims=True)
      else:
          raise NotImplementedError
  
      batch_size = tf.shape(input_tensor)[0]
      # A little weird, because + is overloaded by Tensorflow
      multiples = [1] * (dim + 1)
      multiples[0] = batch_size
      multiples[1:-1] = input_tensor.shape[1:-1]
      multiples = (4,) * dim + (1,)
      multiples = (batch_size,) + multiples
  
      vals = tf.tile(
          vals, multiples=multiples
      )  # Be aware, need updated TF for this to work.
  
      return tf.concat([input_tensor, vals], axis=dim + 1)
  
imports: import tensorflow
label_desc: Use image node_id 8 for calling a global function with example usage: minibatch_state_concat(input_tensor, averaging, dim) and returns: tf