code: def _max_unpooling_2d(
      updates, mask, pool_size=(2, 2), strides=(2, 2), padding="SAME"
  ):
      """Unpool the outputs of a maximum pooling operation."""
      pool_size_attr = " ".join(["i: %d" % v for v in pool_size])
      strides_attr = " ".join(["i: %d" % v for v in strides])
      experimental_implements = [
          'name: "addons:MaxUnpooling2D"',
          'attr { key: "pool_size" value { list {%s} } }'
          % pool_size_attr,
          'attr { key: "strides" value { list {%s} } }' % strides_attr,
          'attr { key: "padding" value { s: "%s" } }' % padding,
      ]
      experimental_implements = " ".join(experimental_implements)
  
      @tf.function(experimental_implements=experimental_implements)
      def func(updates, mask):
          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 = _calculate_output_shape(
              input_shape, pool_size, strides, padding
          )
  
          # 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
  
      return func(updates, mask)
  
file_path: addons/tensorflow_addons/layers/max_unpooling_2d.py
imports: import tensorflow
  from typeguard import typechecked
  from typing import Union, Iterable
  from tensorflow_addons.utils.keras_utils import normalize_tuple
label_desc: Use image node_id 2 for calling a global function with example usage: _max_unpooling_2d(updates, mask, pool_size, strides, padding) and returns: func, ret