docstr: Copy an array to a specified data type irrespective of :ref:`type-
  promotion` rules.
  
  .. note::
  Casting floating-point ``NaN`` and ``infinity`` values to integral data types
  is not specified and is implementation-dependent.
  
  .. note::
  When casting a boolean input array to a numeric data type, a value of ``True``
  must cast to a numeric value equal to ``1``, and a value of ``False`` must cast
  to a numeric value equal to ``0``.
  
  When casting a numeric input array to ``bool``, a value of ``0`` must cast to
  ``False``, and a non-zero value must cast to ``True``.
  
  Parameters
  ----------
  self
      array to cast.
  dtype
      desired data type.
  copy
      specifies whether to copy an array when the specified ``dtype`` matches
      the data type of the input array ``x``. If ``True``, a newly allocated
      array must always be returned. If ``False`` and the specified ``dtype``
      matches the data type of the input array, the input array must be returned;
      otherwise, a newly allocated must be returned. Default: ``True``.
  out
      optional output array, for writing the result to. It must have a shape
      that the inputs broadcast to.
  
  Returns
  -------
  ret
      an array having the specified data type. The returned array must have
      the same shape as ``x``.
  
  Examples
  --------
  Using :class:`ivy.Array` instance method:
  
  >>> x = ivy.array([[-1, -2], [0, 2]])
  >>> print(x.astype(ivy.float64))
  ivy.array([[-1., -2.],  [0.,  2.]])
docstr_tok: ["Copy","an","array","to","a","specified","data","type","irrespective","of",":","ref",":","`","type-","promotion","`","rules",".","..","note",":",":","Casting","floating-point","``","NaN","``","and","``","infinity","``","values","to","integral","data","types","is","not","specified","and","is","implementation-dependent",".","..","note",":",":","When","casting","a","boolean","input","array","to","a","numeric","data","type",",","a","value","of","``","True","``","must","cast","to","a","numeric","value","equal","to","``","1","``",",","and","a","value","of","``","False","``","must","cast","to","a","numeric","value","equal","to","``","0","``",".","When","casting","a","numeric","input","array","to","``","bool","``",",","a","value","of","``","0","``","must","cast","to","``","False","``",",","and","a","non-zero","value","must","cast","to","``","True","``",".","Parameters","--","--","--","--","--","self","array","to","cast",".","dtype","desired","data","type",".","copy","specifies","whether","to","copy","an","array","when","the","specified","``","dtype","``","matches","the","data","type","of","the","input","array","``","x","``",".","If","``","True","``",",","a","newly","allocated","array","must","always","be","returned",".","If","``","False","``","and","the","specified","``","dtype","``","matches","the","data","type","of","the","input","array",",","the","input","array","must","be","returned",";","otherwise",",","a","newly","allocated","must","be","returned",".","Default",":","``","True","``",".","out","optional","output","array",",","for","writing","the","result","to",".","It","must","have","a","shape","that","the","inputs","broadcast","to",".","Returns","--","--","--","-","ret","an","array","having","the","specified","data","type",".","The","returned","array","must","have","the","same","shape","as","``","x","``",".","Examples","--","--","--","--","Using",":","class",":","`","ivy.Array","`","instance","method",":",">",">",">","x","=","ivy.array","(","[","[","-1",",","-2","]",",","[","0",",","2","]","]",")",">",">",">","print","(","x.astype","(","ivy.float64",")",")","ivy.array","(","[","[","-1.",",","-2",".","]",",","[","0.",",","2",".","]","]",")"]
code: def astype(
      self: ivy.Array,
      dtype: ivy.Dtype,
      /,
      *,
      copy: bool = True,
      out: Optional[ivy.Array] = None,
  ) -> ivy.Array:
      """Copy an array to a specified data type irrespective of :ref:`type-
      promotion` rules.
  
      .. note::
      Casting floating-point ``NaN`` and ``infinity`` values to integral data types
      is not specified and is implementation-dependent.
  
      .. note::
      When casting a boolean input array to a numeric data type, a value of ``True``
      must cast to a numeric value equal to ``1``, and a value of ``False`` must cast
      to a numeric value equal to ``0``.
  
      When casting a numeric input array to ``bool``, a value of ``0`` must cast to
      ``False``, and a non-zero value must cast to ``True``.
  
      Parameters
      ----------
      self
          array to cast.
      dtype
          desired data type.
      copy
          specifies whether to copy an array when the specified ``dtype`` matches
          the data type of the input array ``x``. If ``True``, a newly allocated
          array must always be returned. If ``False`` and the specified ``dtype``
          matches the data type of the input array, the input array must be returned;
          otherwise, a newly allocated must be returned. Default: ``True``.
      out
          optional output array, for writing the result to. It must have a shape
          that the inputs broadcast to.
  
      Returns
      -------
      ret
          an array having the specified data type. The returned array must have
          the same shape as ``x``.
  
      Examples
      --------
      Using :class:`ivy.Array` instance method:
  
      >>> x = ivy.array([[-1, -2], [0, 2]])
      >>> print(x.astype(ivy.float64))
      ivy.array([[-1., -2.],  [0.,  2.]])
      """
      return ivy.astype(self._data, dtype, copy=copy, out=out)
  
file_path: ivy/ivy/data_classes/array/data_type.py
imports: import abc
  from typing import Tuple, Optional, List, Union
  import ivy
label_desc: Use image node_id 1 for calling the _ArrayWithDataTypes obj's underlying member method code with example usage: obj.astype() and returns: ivy