code: def nonzero(
      x: paddle.Tensor,
      /,
      *,
      as_tuple: bool = True,
      size: Optional[int] = None,
      fill_value: Number = 0,
  ) -> Union[paddle.Tensor, Tuple[paddle.Tensor]]:
      if paddle.is_complex(x):
          real_idx = paddle.nonzero(x.real())
          imag_idx = paddle.nonzero(x.imag())
          idx = paddle.concat([real_idx, imag_idx], axis=0)
          res = paddle.unique(idx, axis=0)
      else:
          res = paddle.nonzero(x)
  
      res = res.T
      if size is not None:
          if isinstance(fill_value, float):
              res = res.cast(paddle.float64)
          diff = size - res[0].shape[0]
          if diff > 0:
              res = paddle.nn.functional.pad(
                  res.unsqueeze(0),
                  [0, diff],
                  mode="constant",
                  value=fill_value,
                  data_format="NCL",
              ).squeeze(0)
          elif diff < 0:
              res = res[:, :size]
  
      if as_tuple:
          return tuple(res)
      return res.T
  
file_path: ivy/ivy/functional/backends/paddle/searching.py
imports: from numbers import Number
  from typing import Optional, Tuple, Union
  import paddle
  import ivy.functional.backends.paddle
  import ivy
  from ivy.func_wrapper import with_supported_dtypes, with_unsupported_dtypes
  from .None import backend_version
  from .elementwise import _elementwise_helper
label_desc: Use image node_id 3 for calling a global function with example usage: nonzero() and returns: res, tuple