code: def _init_data(self, data, dtype, copy):
      if isinstance(data, str):
          self._process_str_data(data, dtype)
      elif isinstance(data, (list, ndarray)) or ivy.is_array(data):
          if isinstance(data, ndarray):
              data = data.ivy_array
          if ivy.is_array(data) and dtype is None:
              dtype = data.dtype
          data = ivy.array(data, dtype=dtype, copy=copy)
          self._data = data
      elif ivy.isscalar(data):
          self._data = ivy.asarray(data, dtype=dtype)
      else:
          raise ivy.utils.exceptions.IvyException(
              "data must be an array, list, or scalar"
          )
      if self._data.ndim < 2:
          self._data = self._data.reshape((1, -1))
      elif self._data.ndim > 2:
          newshape = tuple(x for x in self._data.shape if x > 1)
          ndim = len(newshape)
          if ndim == 2:
              self._data = self._data.reshape(newshape)
          else:
              raise ValueError("shape too large to be a matrix.")
      self._dtype = self._data.dtype
      self._shape = ivy.shape(self._data)
  
file_path: ivy/ivy/functional/frontends/numpy/matrix/methods.py
imports: import ivy
  from ivy.functional.frontends.numpy import argmax, any, ndarray
label_desc: Use image node_id 2 for calling the matrix obj's underlying member method code with example usage: obj._init_data(data, dtype, copy) without return types