code: def _max_unpooling_2d_v2(updates, mask, output_size):
      """Unpool the outputs of a maximum pooling operation."""
      mask = tf.cast(mask, "int32")
      input_shape = tf.shape(updates, out_type="int32")
      input_shape = [
          updates.shape[i] or input_shape[i] for i in range(4)
      ]
      output_shape = output_size
  
      # Calculates indices for batch, height, width and feature maps.
      one_like_mask = tf.ones_like(mask, dtype="int32")
      batch_shape = tf.concat([[input_shape[0]], [1], [1], [1]], axis=0)
      batch_range = tf.reshape(
          tf.range(output_shape[0], dtype="int32"), shape=batch_shape
      )
      b = one_like_mask * batch_range
      y = mask // (output_shape[2] * output_shape[3])
      x = (mask // output_shape[3]) % output_shape[2]
      feature_range = tf.range(output_shape[3], dtype="int32")
      f = one_like_mask * feature_range
  
      # Transposes indices & reshape update values to one dimension.
      updates_size = tf.size(updates)
      indices = tf.transpose(
          tf.reshape(tf.stack([b, y, x, f]), [4, updates_size])
      )
      values = tf.reshape(updates, [updates_size])
      ret = tf.scatter_nd(indices, values, output_shape)
      return ret
  
file_path: addons/tensorflow_addons/layers/max_unpooling_2d_v2.py
imports: import tensorflow
  from typeguard import typechecked
  from typing import Iterable
  from tensorflow_addons.utils.keras_utils import normalize_tuple
label_desc: Use image node_id 1 for calling a global function with example usage: _max_unpooling_2d_v2(updates, mask, output_size) and returns: ret