code: def searchsorted(
      x: torch.Tensor,
      v: torch.Tensor,
      /,
      *,
      side: Literal["left", "right"] = "left",
      sorter: Optional[Union[torch.Tensor, List[int]]] = None,
      ret_dtype: torch.dtype = torch.int64,
      out: Optional[torch.Tensor] = None,
  ) -> torch.Tensor:
      assert ivy.is_int_dtype(ret_dtype), TypeError(
          "only Integer data types are supported for ret_dtype."
      )
      if sorter is not None:
          sorter_dtype = ivy.as_native_dtype(sorter.dtype)
          assert ivy.is_int_dtype(sorter_dtype), TypeError(
              f"Only signed integer data type for sorter is allowed, got {sorter_dtype }."
          )
          if sorter_dtype is not torch.int64:
              sorter = sorter.to(torch.int64)
      ret_dtype = ivy.as_native_dtype(ret_dtype)
      func_out = out
      if ivy.exists(out) and out.dtype != ret_dtype:
          func_out = None
      if ret_dtype is torch.int64:
          return torch.searchsorted(
              x,
              v,
              sorter=sorter,
              side=side,
              out_int32=False,
              out=func_out,
          )
      elif ret_dtype is torch.int32:
          return torch.searchsorted(
              x,
              v,
              sorter=sorter,
              side=side,
              out_int32=True,
              out=func_out,
          )
      if ivy.exists(out):
          return ivy.inplace_update(
              out,
              torch.searchsorted(x, v, sorter=sorter, side=side).to(
                  out.dtype
              ),
          )
      return torch.searchsorted(x, v, sorter=sorter, side=side).to(
          ret_dtype
      )
  
file_path: ivy/ivy/functional/backends/torch/sorting.py
imports: import torch
  from typing import Optional, Literal, Union, List
  import ivy
  from ivy.func_wrapper import with_unsupported_dtypes
  from .None import backend_version
label_desc: Use image node_id 4 for calling a global function with example usage: searchsorted() and returns: torch, torch, ivy, torch