MCPcopy Create free account
hub / github.com/numpy/numpy / __array__

Method __array__

numpy/array_api/_array_object.py:117–124  ·  view source on GitHub ↗

Warning: this method is NOT part of the array API spec. Implementers of other libraries need not include it, and users should not assume it will be present in other implementations.

(self, dtype: None | np.dtype[Any] = None)

Source from the content-addressed store, hash-verified

115 # This function is not required by the spec, but we implement it here for
116 # convenience so that np.asarray(np.array_api.Array) will work.
117 def __array__(self, dtype: None | np.dtype[Any] = None) -> npt.NDArray[Any]:
118 """
119 Warning: this method is NOT part of the array API spec. Implementers
120 of other libraries need not include it, and users should not assume it
121 will be present in other implementations.
122
123 """
124 return np.asarray(self._array, dtype=dtype)
125
126 # These are various helper functions to make the array behavior match the
127 # spec in places where it either deviates from or is more strict than

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected