dtype is copy assignable (#1436)

This commit is contained in:
Awni Hannun
2024-09-25 12:07:13 -07:00
committed by GitHub
parent 195b429d99
commit afc9c0ec1b
7 changed files with 29 additions and 18 deletions

View File

@@ -97,7 +97,8 @@ void init_array(nb::module_& m) {
See the :ref:`list of types <data_types>` for more details
on available data types.
)pbdoc")
.def_ro("size", &Dtype::size, R"pbdoc(Size of the type in bytes.)pbdoc")
.def_prop_ro(
"size", &Dtype::size, R"pbdoc(Size of the type in bytes.)pbdoc")
.def(
"__repr__",
[](const Dtype& t) {
@@ -112,7 +113,7 @@ void init_array(nb::module_& m) {
return nb::isinstance<Dtype>(other) && t == nb::cast<Dtype>(other);
})
.def("__hash__", [](const Dtype& t) {
return static_cast<int64_t>(t.val);
return static_cast<int64_t>(t.val());
});
m.attr("bool_") = nb::cast(bool_);