class_docstr: Base class for nested array objects.
class_docstr_tok: ["Base","class","for","nested","array","objects","."]
code: def nested_array(
      cls,
      data,
      nested_rank=None,
      inner_shape=None,
      dtype=None,
      device=None,
  ):
      dtype = ivy.default_dtype(dtype=dtype, item=data)
      device = ivy.default_device(device, item=data)
  
      # convert all the leaf lists to ivy arrays, determine inner_shape and depth
      det_inner_shape = []
  
      # ToDo: add check for depth being the same for all nests
      def _seq_to_ivy(x, depth=0):
          if nested_rank is not None and depth >= nested_rank:
              x = ivy.array(x, dtype=dtype, device=device)
              depth += x.ndim - 1
              if x.ndim > 1:
                  det_inner_shape.append(list(x.shape[1:]))
              else:
                  det_inner_shape.append([])
          elif (
              isinstance(x, (list, tuple))
              and len(x) != 0
              and isinstance(x[0], (list, tuple))
          ):
              depth_ret = None
              for i, item in enumerate(x):
                  x = list(x) if isinstance(x, tuple) else x
                  x[i], depth_ret = _seq_to_ivy(item, depth=depth + 1)
  
              depth = depth_ret if depth_ret else depth
          else:
              x = ivy.array(x, dtype=dtype, device=device)
              if x.ndim > 1:
                  det_inner_shape.append(list(x.shape[1:]))
              else:
                  det_inner_shape.append([])
          return x, depth
  
      if isinstance(data, (list, tuple)):
          data, depth = _seq_to_ivy(data)
          depth += 1
          # make sure that all the elements of det_inner_shape are the same
          if len(det_inner_shape) > 0:
              if [det_inner_shape[0]] * len(
                  det_inner_shape
              ) != det_inner_shape:
                  raise ValueError(
                      "All the elements of the nested array must have the same "
                      f"inner shape, got: {det_inner_shape}"
                  )
              det_inner_shape = det_inner_shape[0]
  
          # defining default values for nested_rank and inner_shape
          default_nested_rank = (
              max(0, depth - 1)
              if inner_shape is None
              else max(0, depth - 1 - len(inner_shape))
          )
          default_inner_shape = (
              [] if nested_rank is None else det_inner_shape
          )
  
          # determining actual values for nested_rank and inner_shape
          nested_rank = (
              nested_rank
              if nested_rank is not None
              else default_nested_rank
          )
          inner_shape = (
              list(inner_shape)
              if inner_shape is not None
              else default_inner_shape
          )
      elif isinstance(data, cls):
          data = data._data
          nested_rank = (
              nested_rank
              if nested_rank is not None
              else data.nested_rank
          )
          inner_shape = (
              list(inner_shape)
              if list(inner_shape) is not None
              else data.inner_shape
          )
      else:
          raise TypeError(
              f"Input data must be pylist or tuple, got: {type(data)}"
          )
  
      return cls(
          data, nested_rank, inner_shape, dtype, device, internal=True
      )
  
imports: import abc
  from typing import List, Tuple
  import ivy
label_desc: Use image node_id 2 for calling the NestedArrayBase obj's underlying member method code with example usage: obj.nested_array(cls, data, nested_rank, inner_shape, dtype, device) and returns: cls, x,  depth