Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/src/python/ops.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Operations
array_equal
asarray
as_strided
astype
atleast_1d
atleast_2d
atleast_3d
Expand Down
24 changes: 23 additions & 1 deletion python/src/ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3399,6 +3399,25 @@ void init_ops(nb::module_& m) {
Returns:
array: The output array which is the strided view of the input.
)pbdoc");
m.def(
"astype",
&mx::astype,
nb::arg(),
"dtype"_a,
nb::kw_only(),
"stream"_a = nb::none(),
nb::sig(
"def astype(a: array, dtype: Dtype, /, *, stream: Union[None, Stream, Device] = None) -> array"),
R"pbdoc(
Cast the array to a specified type.

Args:
a (array): Input array.
dtype (Dtype): Type to which the array is cast.

Returns:
array: The array with type ``dtype``.
)pbdoc");
m.def(
"cumsum",
[](const mx::array& a,
Expand Down Expand Up @@ -5849,7 +5868,10 @@ void init_ops(nb::module_& m) {
m.attr("atan") = m.attr("arctan");
m.attr("atanh") = m.attr("arctanh");
m.attr("atan2") = m.attr("arctan2");
m.attr("pow") = m.attr("power");
m.attr("bitwise_left_shift") = m.attr("left_shift");
m.attr("bitwise_right_shift") = m.attr("right_shift");
m.attr("empty") = m.attr("zeros");
m.attr("empty_like") = m.attr("zeros_like");
m.attr("matrix_transpose") = m.attr("transpose");
m.attr("pow") = m.attr("power");
}
Loading