code: def scatter_nd(
      indices: Union[tf.Tensor, tf.Variable],
      updates: Union[tf.Tensor, tf.Variable],
      /,
      shape: Optional[Union[ivy.NativeShape, Sequence[int]]] = None,
      *,
      reduction: str = "sum",
      out: Optional[Union[tf.Tensor, tf.Variable]] = None,
  ) -> Union[tf.Tensor, tf.Variable]:
      updates_dtype = updates.dtype
      if ivy.exists(out):
          dtype = ivy.promote_types(out.dtype, updates_dtype)
      updates = tf.cast(
          updates,
          (
              ivy.as_native_dtype(dtype)
              if ivy.exists(out)
              else updates_dtype
          ),
      )
  
      expected_shape = (
          list(indices.shape[:-1])
          + list(out.shape[indices.shape[-1] :])
          if ivy.exists(out)
          else list(indices.shape[:-1])
          + list(shape[indices.shape[-1] :])
      )
      updates = _broadcast_to(updates, expected_shape)._data
      if len(updates.shape) == 0:
          indices = tf.expand_dims(indices, 0)
          updates = tf.expand_dims(updates, 0)
  
      # implementation
      target = out
      target_given = ivy.exists(target)
      if ivy.exists(shape) and target_given:
          ivy.utils.assertions.check_equal(
              ivy.Shape(target.shape), ivy.Shape(shape), as_array=False
          )
      if not target_given:
          shape = list(shape) if ivy.exists(shape) else list(out.shape)
          target = tf.zeros(shape, dtype=updates.dtype)
      if reduction == "sum":
          res = tf.tensor_scatter_nd_add(target, indices, updates)
      elif reduction == "min":
          res = tf.tensor_scatter_nd_min(target, indices, updates)
      elif reduction == "max":
          res = tf.tensor_scatter_nd_max(target, indices, updates)
      elif reduction == "mul":
          updates = ivy.multiply(
              ivy.gather_nd(target, indices), updates
          ).data
          res = tf.tensor_scatter_nd_update(target, indices, updates)
      elif reduction == "replace":
          res = tf.tensor_scatter_nd_update(target, indices, updates)
      else:
          raise ivy.utils.exceptions.IvyException(
              f'reduction is {reduction}, but it must be one of "sum", "min", "max",'
              ' "mul" or "replace"'
          )
      if ivy.exists(out):
          return ivy.inplace_update(out, res)
      return res
  
imports: from typing import Optional, Union, Sequence, Callable, Tuple
  import numpy
  import multiprocessing
  from numbers import Number
  import tensorflow
  import ivy
  from ivy.functional.ivy.gradients import _is_variable
  from ivy.func_wrapper import with_unsupported_dtypes
  from ivy.utils.exceptions import _check_inplace_update_support
  from .None import backend_version
  from ...ivy.general import _broadcast_to
label_desc: Use image node_id 22 for calling a global function with example usage: scatter_nd(shape) and returns: res, ivy