Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support setitem by None index #34442

Merged
merged 6 commits into from
Jul 30, 2021
Merged

Support setitem by None index #34442

merged 6 commits into from
Jul 30, 2021

Conversation

zyfncg
Copy link
Contributor

@zyfncg zyfncg commented Jul 28, 2021

PR types

New features

PR changes

APIs

Describe

Support setitem by None index

Example:

x = paddle.to_tensor(np.array([[[1, 2], [3, 4]], [[5, 6], [7, 8]]]).astype(np.float32))
x[:, None, 0] = 2.0
x[0, 0, :, None] = np.array([[0], [0]])

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@@ -127,6 +127,8 @@ class SetValueMaker : public framework::OpProtoAndCheckerMaker {
AddAttr<std::vector<int64_t>>("decrease_axes",
"(list<int>) The axes to decrease.")
.SetDefault({});
AddAttr<std::vector<int64_t>>("none_axes", "(list<int>) The axes to none.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

看一下set_value_op下面的版本控制,新增attr要声明版本,否则可能会造成推理的兼容问题

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@hbwx24 hbwx24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@chenwhql chenwhql left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chenwhql chenwhql merged commit f775bfc into PaddlePaddle:develop Jul 30, 2021
@zyfncg zyfncg deleted the zyf_slice branch August 16, 2021 02:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants