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

[Zero-Dim] fix Tensor.numpy, control whether to hack process to 1D #51757

Merged
merged 1 commit into from
Mar 20, 2023

Conversation

zhwesky2010
Copy link
Contributor

@zhwesky2010 zhwesky2010 commented Mar 16, 2023

PR types

Bug fixes

PR changes

APIs

Describe

Tensor.numpy()的hack为1D的处理,由于框架内部某些API调用了Tensor.numpy(),该hack处理会扩散到框架其他的API,导致一些其他错误的出现,因此增加了一个set_to_1d参数控制是否hack处理,默认下:Tensor.numpy() 会将0D hack处理为1D;Tensor.numpy(False) 则没有该hack操作;

注意:这部分的hack代码仅保持一定版本,后续下个大版本,会移除这些全部hack代码。

@zhwesky2010 zhwesky2010 changed the title [Zero-Dim] fix Tensor.numpy problem [Zero-Dim] fix Tensor.numpy and unsqueeze with empty axis bug Mar 17, 2023
@zhwesky2010 zhwesky2010 force-pushed the fix_numpy_0d branch 2 times, most recently from af4bde6 to 935aeb6 Compare March 19, 2023 14:11
@zhwesky2010 zhwesky2010 changed the title [Zero-Dim] fix Tensor.numpy and unsqueeze with empty axis bug [Zero-Dim] fix Tensor.numpy, cntrol whether to hack process to 1D Mar 19, 2023
@zhwesky2010 zhwesky2010 changed the title [Zero-Dim] fix Tensor.numpy, cntrol whether to hack process to 1D [Zero-Dim] fix Tensor.numpy, control whether to hack process to 1D Mar 20, 2023
@zhwesky2010 zhwesky2010 merged commit d703545 into PaddlePaddle:develop Mar 20, 2023
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.

2 participants