code: def map_coordinates(
      input, coordinates, order, fill_mode="constant", fill_value=0.0
  ):
      input_arr = convert_to_tensor(input)
      coordinate_arrs = [convert_to_tensor(c) for c in coordinates]
      # skip tensor creation as possible
      if isinstance(fill_value, (int, float)) and _is_integer(
          input_arr
      ):
          fill_value = int(fill_value)
  
      if len(coordinates) != len(input_arr.shape):
          raise ValueError(
              "coordinates must be a sequence of length input.shape, but "
              f"{len(coordinates)} != {len(input_arr.shape)}"
          )
  
      index_fixer = _INDEX_FIXERS.get(fill_mode)
      if index_fixer is None:
          raise ValueError(
              "Invalid value for argument `fill_mode`. Expected one of "
              f"{set(_INDEX_FIXERS.keys())}. Received: fill_mode={fill_mode}"
          )
  
      if order == 0:
          interp_fun = _nearest_indices_and_weights
      elif order == 1:
          interp_fun = _linear_indices_and_weights
      else:
          raise NotImplementedError(
              "map_coordinates currently requires order<=1"
          )
  
      if fill_mode == "constant":
  
          def is_valid(index, size):
              return (0 <= index) & (index < size)
  
      else:
  
          def is_valid(index, size):
              return True
  
      valid_1d_interpolations = []
      for coordinate, size in zip(coordinate_arrs, input_arr.shape):
          interp_nodes = interp_fun(coordinate)
          valid_interp = []
          for index, weight in interp_nodes:
              fixed_index = index_fixer(index, size)
              valid = is_valid(index, size)
              valid_interp.append((fixed_index, valid, weight))
          valid_1d_interpolations.append(valid_interp)
  
      outputs = []
      for items in itertools.product(*valid_1d_interpolations):
          indices, validities, weights = zip(*items)
          if all(valid is True for valid in validities):
              # fast path
              contribution = input_arr[indices]
          else:
              all_valid = functools.reduce(operator.and_, validities)
              contribution = torch.where(
                  all_valid, input_arr[indices], fill_value
              )
          outputs.append(
              functools.reduce(operator.mul, weights) * contribution
          )
      result = functools.reduce(operator.add, outputs)
      if _is_integer(input_arr):
          result = (
              result if _is_integer(result) else torch.round(result)
          )
      return result.to(input_arr.dtype)
  
file_path: keras/keras/backend/torch/image.py
imports: import functools
  import itertools
  import operator
  import torch
  from keras.backend.torch.core import convert_to_tensor
label_desc: Use image node_id 8 for calling a global function with example usage: map_coordinates(input, coordinates, order, fill_mode, fill_value) and returns: result, unknown, True