code: def sample_inputs_index_put(
      op_info, device, dtype, requires_grad, **kwargs
  ):
      make_arg = partial(
          make_tensor,
          dtype=dtype,
          device=device,
          requires_grad=requires_grad,
      )
      make_idx = partial(
          make_tensor,
          dtype=torch.long,
          device=device,
          requires_grad=False,
      )
      S = 5
      inputs = []
      for accumulate in [False, True]:
          # putting vectors at indexed locations
          inputs.append(
              SampleInput(
                  make_arg((S, S)),
                  args=(
                      (make_idx((2,), low=0, high=4),),
                      make_arg((2, S)),
                  ),
                  kwargs=dict(accumulate=accumulate),
              )
          )
  
          # putting multi-dim tensors at indexed locations
          inputs.append(
              SampleInput(
                  make_arg((S, S, 2)),
                  args=(
                      (make_idx((3,), low=0, high=4),),
                      make_arg((3, S, 2)),
                  ),
                  kwargs=dict(accumulate=accumulate),
              )
          )
  
          # value with size `0` dim
          inputs.append(
              SampleInput(
                  make_arg((S, 0)),
                  args=(
                      (make_idx((3,), low=0, high=4),),
                      make_arg((3, 0)),
                  ),
                  kwargs=dict(accumulate=accumulate),
              )
          )
  
          # scalar value
          inputs.append(
              SampleInput(
                  make_arg((S,)),
                  args=((make_idx((), low=0, high=S),), make_arg(())),
                  kwargs=dict(accumulate=accumulate),
              )
          )
  
          # cuda and accumulate don't work well
          # Reference: https://github.com/pytorch/pytorch/issues/72053
          if not accumulate and device == "cuda":
              # Broadcast `values`
              inputs.append(
                  SampleInput(
                      make_arg((S, S)),
                      args=(
                          (make_idx((2,), low=0, high=S),),
                          make_arg((S,)),
                      ),
                      kwargs=dict(accumulate=accumulate),
                  )
              )
  
      return inputs
  
file_path: pytorch/test/functorch/functorch_additional_op_db.py
imports: from functools import partial
  import itertools
  import unittest
  import torch
  from torch.testing._internal.common_dtype import floating_types, floating_types_and, all_types_and_complex_and
  from torch.testing._internal.common_utils import make_tensor
  from torch.testing._internal.common_methods_invocations import OpInfo, SampleInput, DecorateInfo
label_desc: Use image node_id 6 for calling a global function with example usage: sample_inputs_index_put(op_info, device, dtype, requires_grad) and returns: inputs