-
Notifications
You must be signed in to change notification settings - Fork 5.9k
【Hackathon 7th No.20】为 Paddle 新增 Tensor.set_ -part #68681
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
Conversation
|
你的PR提交成功,感谢你对开源项目的贡献! |
| 1 | ||
| """ | ||
| if in_dynamic_mode(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add data dtype check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added in branch source is not None
|
|
||
| } // namespace phi | ||
|
|
||
| PD_REGISTER_KERNEL_FOR_ALL_BACKEND_DTYPE(set, STRIDED, phi::SetInplaceKernel) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add register for cpu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does PD_REGISTER_KERNEL_FOR_ALL_BACKEND_DTYPE already register for cpu?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PD_REGISTER_KERNEL is work for cpu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
|
Sorry to inform you that 0322026's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually. |
python/paddle/tensor/creation.py
Outdated
| raise ValueError( | ||
| f"Input (source) should be paddle.Tensor but received {type(source)}" | ||
| ) | ||
| if source.dtype not in [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suppose to use check_dtype(), also in python code, "bfloat16" should type with "uint16"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
| int64_t, | ||
| float, | ||
| double, | ||
| phi::dtype::complex<float>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is CPU unspport float16 and bfloat16?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know whether all kind of CPU support float16 and bfloat16 so they are not registered here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can try the same way with paddle/phi/kernels/strided_slice_kernel.cc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, float16 and bfloat16 are added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
STRIDED may change to ALL_LAYOUT ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| @@ -0,0 +1,77 @@ | |||
| // Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inplace is a concept in the level of ops(in the ops.yaml), representing the space where ops's output can write to the space of input. so in the level of kernel, there is no concept of inplace, because both inplace ops and non-inplace ops use the same computational logic and the same kernel.
so, we suggest filename is set_kernel.cc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
| @@ -0,0 +1,30 @@ | |||
| // Copyright (c) 2024 PaddlePaddle Authors. All Rights Reserved. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inplace is a concept in the level of ops(in the ops.yaml), representing the space where ops's output can write to the space of input. so in the level of kernel, there is no concept of inplace, because both inplace ops and non-inplace ops use the same computational logic and the same kernel.
so, we suggest filename is set_kernel.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revised
python/paddle/__init__.py
Outdated
| 'diagonal_scatter', | ||
| 'combinations', | ||
| 'signbit', | ||
| 'set_', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to support the usage of paddle.set_(x, source, ....)? If it is not recommended for users to use it this way(recommended only x.set_(source, ...) when x is Tensor), there is no need to add it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This time only support Tensor.set_ , this line can be deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for docs
|
可以提交中文文档啦 |
PR Category
User Experience
PR Types
New features
Description
rfc: PaddlePaddle/community#968