From f581ef2348e6eff7d484be1c170d422eaaa50efc Mon Sep 17 00:00:00 2001 From: zyfncg Date: Mon, 16 Aug 2021 02:38:16 +0000 Subject: [PATCH 1/2] Change invoking mathod of the settiem by Ellipsis and None index from numpy to set_value op --- paddle/fluid/pybind/imperative.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/pybind/imperative.cc b/paddle/fluid/pybind/imperative.cc index 0b6af3b542395d..4d0fb9d692e799 100644 --- a/paddle/fluid/pybind/imperative.cc +++ b/paddle/fluid/pybind/imperative.cc @@ -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; } From 77160eab9a457be411026aacd8b0300cac555766 Mon Sep 17 00:00:00 2001 From: zyfncg Date: Mon, 16 Aug 2021 04:57:56 +0000 Subject: [PATCH 2/2] add none_axes into attr of set_value_op in dygraph mode --- paddle/fluid/pybind/imperative.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/pybind/imperative.cc b/paddle/fluid/pybind/imperative.cc index 4d0fb9d692e799..6c4213979a46be 100644 --- a/paddle/fluid/pybind/imperative.cc +++ b/paddle/fluid/pybind/imperative.cc @@ -808,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}}};