-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
add inplace api transpose_, t_, normal_,cauchy_, geometric_ #57093
add inplace api transpose_, t_, normal_,cauchy_, geometric_ #57093
Conversation
… add_transpose_cauchy_geometric_inpalce_api
你的PR提交成功,感谢你对开源项目的贡献! |
… add_transpose_cauchy_geometric_inpalce_api
… add_transpose_cauchy_geometric_inpalce_api
# [-0.34646994, -0.45116323, -0.09902662, -0.11397249], # random | ||
# [ 0.433519, 0.39483607, -0.8660099, 0.83664286]] # random | ||
""" | ||
return _C_ops.gaussian_inplace_(x, float(mean), float(std), int(seed)) |
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.
If we want to support the mean and variance of complex numbers, there will be problems with this processing
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.
will be replaced by scalar when adding complex support
float mean, | ||
float std, |
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.
if dtype of x
is double, implicit type conversion will be performed in mean
and std
, resulting in a loss of accuracy.
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.
As above
@@ -1052,6 +1052,19 @@ | |||
func : gather_tree | |||
data_type : ids | |||
|
|||
- op : gaussian_inplace |
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算子来着?
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.
原有的gassian算子没有输入tensor,如果用gaussian+assign的方式梯度计算会不对
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.
现有的uniform_inplace也是新增的uniform_inpalce算子, uniform+gaussian 可以组合出所有其他的分布,后续用应该也不需要新增其他的这种算子了
… add_transpose_cauchy_geometric_inpalce_api
>>> import paddle | ||
>>> x = paddle.randn([3, 4]) | ||
>>> x.cauchy_(1, 2) | ||
>>> # doctest: +SKIP('random 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.
像这些部分,设置 paddle.seed 也不能固定输出嘛?因为ci检查时设备也是固定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.
seed对目前的分布类没用, paddle.distribution.Cauchy,设置了种子也会随机输出
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
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
…ddle#57093) * add inplace * fix transpose inpalce error * fix error * fix * fix * add gaussian inpalce kernel * change cauchy_ gepmetric impl * fix typro * add test * remove gaussian test * fix sample code error * fix sample code * fix sample code error
…ddle#57093) * add inplace * fix transpose inpalce error * fix error * fix * fix * add gaussian inpalce kernel * change cauchy_ gepmetric impl * fix typro * add test * remove gaussian test * fix sample code error * fix sample code * fix sample code error
…ddle#57093) * add inplace * fix transpose inpalce error * fix error * fix * fix * add gaussian inpalce kernel * change cauchy_ gepmetric impl * fix typro * add test * remove gaussian test * fix sample code error * fix sample code * fix sample code error
PR types
New features
PR changes
APIs
Description
Pcard-75099
add inplace api transpose_, t_, cauchy_, geometric_, normal_