Add view op (#1179)

* add view primitive

* nit

* fix view
This commit is contained in:
Awni Hannun
2024-06-04 08:05:27 -07:00
committed by GitHub
parent 81def6ac76
commit ea9090bbc4
14 changed files with 202 additions and 11 deletions

View File

@@ -1276,5 +1276,14 @@ void init_array(nb::module_& m) {
},
nb::kw_only(),
"stream"_a = nb::none(),
"See :func:`conj`.");
"See :func:`conj`.")
.def(
"view",
[](const ScalarOrArray& a, const Dtype& dtype, StreamOrDevice s) {
return view(to_array(a), dtype, s);
},
"dtype"_a,
nb::kw_only(),
"stream"_a = nb::none(),
"See :func:`view`.");
}