code: def spatial_soft_argmax2d(
      input: Tensor,
      temperature: Tensor = tensor(1.0),
      normalized_coordinates: bool = True,
  ) -> Tensor:
      r"""Compute the Spatial Soft-Argmax 2D of a given input heatmap.
  
      Args:
          input: the given heatmap with shape :math:`(B, N, H, W)`.
          temperature: factor to apply to input.
          normalized_coordinates: whether to return the coordinates normalized in the range of :math:`[-1, 1]`.
              Otherwise, it will return the coordinates in the range of the input shape.
  
      Returns:
          the index of the maximum 2d coordinates of the give map :math:`(B, N, 2)`.
          The output order is x-coord and y-coord.
  
      Examples:
          >>> input = torch.tensor([[[
          ... [0., 0., 0.],
          ... [0., 10., 0.],
          ... [0., 0., 0.]]]])
          >>> spatial_soft_argmax2d(input, normalized_coordinates=False)
          tensor([[[1.0000, 1.0000]]])
      """
      input_soft: Tensor = spatial_softmax2d(input, temperature)
      output: Tensor = spatial_expectation2d(
          input_soft, normalized_coordinates
      )
      return output
  
imports: from __future__ import annotations
  import torch
  import torch.nn.functional
  from kornia.core import Module, Tensor, concatenate, rand, stack, tensor, where, zeros, zeros_like
  from kornia.filters.sobel import spatial_gradient3d
  from kornia.geometry.conversions import normalize_pixel_coordinates, normalize_pixel_coordinates3d
  from kornia.utils import create_meshgrid, create_meshgrid3d
  from kornia.utils._compat import torch_version_ge
  from kornia.utils.helpers import safe_solve_with_mask
  from .dsnt import spatial_expectation2d, spatial_softmax2d
  from .nms import nms3d
label_desc: Use image node_id 7 for calling a global function with example usage: spatial_soft_argmax2d(input, temperature, normalized_coordinates) and returns: output