Adds radians and degrees (#1011)

This commit is contained in:
Aneesh Shetty
2024-04-22 13:17:49 -05:00
committed by GitHub
parent 3d405fb3b1
commit d0dbfe0b97
7 changed files with 120 additions and 1 deletions

View File

@@ -1032,6 +1032,40 @@ void init_ops(nb::module_& m) {
Returns:
array: The inverse hyperbolic tangent of ``a``.
)pbdoc");
m.def(
"degrees",
&mlx::core::degrees,
nb::arg(),
nb::kw_only(),
"stream"_a = nb::none(),
nb::sig(
"def degrees(a: array, /, *, stream: Union[None, Stream, Device] = None) -> array"),
R"pbdoc(
Convert angles from radians to degrees.
Args:
a (array): Input array.
Returns:
array: The angles in degrees.
)pbdoc");
m.def(
"radians",
&mlx::core::radians,
nb::arg(),
nb::kw_only(),
"stream"_a = nb::none(),
nb::sig(
"def radians(a: array, /, *, stream: Union[None, Stream, Device] = None) -> array"),
R"pbdoc(
Convert angles from degrees to radians.
Args:
a (array): Input array.
Returns:
array: The angles in radians.
)pbdoc");
m.def(
"log",
&mlx::core::log,