code: def _quantile(a, q, axis=None):
      ret_dtype = a.dtype
      if isinstance(q, float):
          q = torch.as_tensor(q)
      if isinstance(q, torch.Tensor) and q.ndim > 1:
          raise ValueError(
              "q argument must be a scalar or 1-dimensional!"
          )
      if axis is None:
          axis = 0
          a = a.flatten()
  
      n = a.shape[axis]
  
      indices = q * (n - 1)
  
      a = torch.sort(a, axis)[axis]
      indices_below = torch.floor(indices).to(torch.int64)
      indices_upper = torch.ceil(indices).to(torch.int64)
  
      weights = indices - indices_below.to(torch.float64)
  
      indices_below = torch.clip(indices_below, 0, n - 1)
      indices_upper = torch.clip(indices_upper, 0, n - 1)
      tensor_upper = torch.index_select(a, 0, indices_upper)
      tensor_below = torch.index_select(a, 0, indices_below)
  
      pred = weights <= 0.5
      out = torch.where(pred, tensor_below, tensor_upper)
      return out.to(ret_dtype)
  
imports: from typing import Optional, Union, Tuple, Sequence
  import torch
  from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes
  from .None import backend_version
  import ivy
  from ..statistical import _infer_dtype
  from copy import deepcopy
label_desc: Use image node_id 9 for calling a global function with example usage: _quantile(a, q, axis) and returns: out