@@ -67,7 +67,7 @@ struct Creator
6767 return TypeDispatch<x::Creator>(dtype, op, std::forward<shape_type>(shape), std::forward<py::object>(val));
6868 }
6969};
70-
70+ # if 0
7171struct IEWBinOp
7272{
7373 static auto op(IEWBinOpId op, x::DPTensorBaseX::ptr_type a, x::DPTensorBaseX::ptr_type b)
@@ -117,6 +117,7 @@ struct ReduceOp
117117 return TypeDispatch<x::ReduceOp>(a->dtype(), op, a, dim);
118118 }
119119};
120+ #endif
120121
121122struct GetItem
122123{
@@ -125,6 +126,13 @@ struct GetItem
125126 return TypeDispatch<x::GetItem>(a->dtype (), a, NDSlice (v));
126127 }
127128};
129+ struct SetItem
130+ {
131+ static auto op (x::DPTensorBaseX::ptr_type a, const std::vector<py::slice> & v, x::DPTensorBaseX::ptr_type b)
132+ {
133+ return TypeDispatch<x::SetItem>(a->dtype (), a, NDSlice (v), b);
134+ }
135+ };
128136
129137rank_type myrank ()
130138{
@@ -162,7 +170,7 @@ PYBIND11_MODULE(_ddptensor, m) {
162170 py::class_<Creator>(m, " Creator" )
163171 .def (" create_from_shape" , &Creator::create_from_shape)
164172 .def (" full" , &Creator::full);
165-
173+ # if 0
166174 py::class_<EWUnyOp>(m, "EWUnyOp")
167175 .def("op", &EWUnyOp::op);
168176
@@ -179,10 +187,12 @@ PYBIND11_MODULE(_ddptensor, m) {
179187
180188 py::class_<ReduceOp>(m, "ReduceOp")
181189 .def("op", &ReduceOp::op);
190+ #endif
182191
183192 py::class_<x::DPTensorBaseX, x::DPTensorBaseX::ptr_type>(m, " DPTensorX" )
184193 .def (" __repr__" , &x::DPTensorBaseX::__repr__)
185- .def (" __getitem__" , &GetItem::op);
194+ .def (" __getitem__" , &GetItem::op)
195+ .def (" __setitem__" , &SetItem::op);
186196
187197#if 0
188198 py::class_<dtensor>(m, "dtensor")
0 commit comments