parameters: (x, v, side='left', sorter=None)
return_statement: return j
docstring: Finds indices where elements should be inserted to maintain order.
  
      Args:
          v (Union[int, float, bool, list, tuple, Tensor]): Values to insert into `a`.
          side ('left', 'right', optional): If 'left', the index of the first suitable
              location found is given. If 'right', return the last such index. If there is
              no suitable index, return either 0 or N (where N is the length of `a`).
          sorter (Union[int, float, bool, list, tuple, Tensor]): 1-D optional array of
              integer indices that sort array `a` into ascending order. They are typically
              the result of argsort.
  
      Returns:
          Tensor, array of insertion points with the same shape as `v`.
  
      Raises:
          ValueError: if argument for `side` or `sorter` is invalid.
  
      Supported Platforms:
          ``Ascend`` ``GPU`` ``CPU``
  
      Examples:
          >>> from mindspore import numpy as np
          >>> x = np.array([1,2,3,4,5])
          >>> print(x.searchsorted(3))
          2
docstring_summary: Finds indices where elements should be inserted to maintain order.
docstring_tokens: Finds indices where elements should be inserted to maintain order .
function: def searchsorted(x, v, side='left', sorter=None):
      """
      Finds indices where elements should be inserted to maintain order.
  
      Args:
          v (Union[int, float, bool, list, tuple, Tensor]): Values to insert into `a`.
          side ('left', 'right', optional): If 'left', the index of the first suitable
              location found is given. If 'right', return the last such index. If there is
              no suitable index, return either 0 or N (where N is the length of `a`).
          sorter (Union[int, float, bool, list, tuple, Tensor]): 1-D optional array of
              integer indices that sort array `a` into ascending order. They are typically
              the result of argsort.
  
      Returns:
          Tensor, array of insertion points with the same shape as `v`.
  
      Raises:
          ValueError: if argument for `side` or `sorter` is invalid.
  
      Supported Platforms:
          ``Ascend`` ``GPU`` ``CPU``
  
      Examples:
          >>> from mindspore import numpy as np
          >>> x = np.array([1,2,3,4,5])
          >>> print(x.searchsorted(3))
          2
      """
      if side not in ('left', 'right'):
          const_utils.raise_value_error('invalid value for keyword "side"')
      a = x.astype(mstype.float32)
      if not check_is_tensor(F.typeof(v)):
          v = const_utils.make_tensor(v)
      shape = v.shape
      if sorter is not None:
          if sorter.ndim != 1 or sorter.size != a.size:
              const_utils.raise_value_error('sorter must be 1-D array with the same size as `a`')
          sorter = const_utils.make_tensor(sorter)
          sorter = sorter.reshape(sorter.shape + (1,))
          a = F.gather_nd(a, sorter)
      less_op = F.tensor_le if side == 'left' else F.tensor_lt
      i = F.fill(mstype.int32, shape, 0)
      j = F.fill(mstype.int32, shape, a.size)
  
      sort_range = F.make_range(get_log2_size(F.shape_mul(a.shape) + 1))
      for _ in sort_range:
          mid = (i - F.neg_tensor(j))//2
          mask = less_op(v, F.gather_nd(a, mid.reshape(mid.shape + (1,))))
          i = F.select(mask, i, mid)
          j = F.select(mask, mid, j)
      return j
function_tokens: def searchsorted ( x , v , side = 'left' , sorter = None ) : if side not in ( 'left' , 'right' ) : const_utils . raise_value_error ( 'invalid value for keyword "side"' ) a = x . astype ( mstype . float32 ) if not check_is_tensor ( F . typeof ( v ) ) : v = const_utils . make_tensor ( v ) shape = v . shape if sorter is not None : if sorter . ndim != 1 or sorter . size != a . size : const_utils . raise_value_error ( 'sorter must be 1-D array with the same size as `a`' ) sorter = const_utils . make_tensor ( sorter ) sorter = sorter . reshape ( sorter . shape + ( 1 , ) ) a = F . gather_nd ( a , sorter ) less_op = F . tensor_le if side == 'left' else F . tensor_lt i = F . fill ( mstype . int32 , shape , 0 ) j = F . fill ( mstype . int32 , shape , a . size ) sort_range = F . make_range ( get_log2_size ( F . shape_mul ( a . shape ) + 1 ) ) for _ in sort_range : mid = ( i - F . neg_tensor ( j ) ) // 2 mask = less_op ( v , F . gather_nd ( a , mid . reshape ( mid . shape + ( 1 , ) ) ) ) i = F . select ( mask , i , mid ) j = F . select ( mask , mid , j ) return j