Skip to content

Commit

Permalink
Change the invoking method of settiem by Ellipsis and None index from…
Browse files Browse the repository at this point in the history
… numpy to set_value op (#34911)

* Change invoking mathod of the settiem by Ellipsis and None index from numpy to set_value op

* add none_axes into attr of set_value_op in dygraph mode
  • Loading branch information
zyfncg committed Aug 16, 2021
1 parent d028214 commit 2e30134
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions paddle/fluid/pybind/imperative.cc
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,8 @@ void BindImperative(py::module *m_ptr) {
const int size = PyTuple_GET_SIZE(index_ptr);
for (int dim = 0; dim < size; ++dim) {
PyObject *slice_item = PyTuple_GetItem(index_ptr, dim);
if (!(PyCheckInteger(slice_item) || PySlice_Check(slice_item))) {
if (!(PyCheckInteger(slice_item) || PySlice_Check(slice_item) ||
slice_item == Py_Ellipsis || slice_item == Py_None)) {
parse_index = false;
break;
}
Expand All @@ -807,7 +808,8 @@ void BindImperative(py::module *m_ptr) {
{"starts", starts},
{"ends", ends},
{"steps", steps},
{"decrease_axes", decrease_axes}};
{"decrease_axes", decrease_axes},
{"none_axes", none_axes}};

imperative::NameVarBaseMap ins = {{"Input", {self}}};
imperative::NameVarBaseMap outs = {{"Out", {self}}};
Expand Down

0 comments on commit 2e30134

Please sign in to comment.