Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
【PaddlePaddle Hackathon 第四期】No.6:为 Paddle 新增 ldexp API #51395
【PaddlePaddle Hackathon 第四期】No.6:为 Paddle 新增 ldexp API #51395
Changes from 25 commits
f7e08fb
fc3e18e
f5021b8
79c798a
677b152
1d2c77d
1e0a6d7
d182aa0
44aa6dd
dc62e14
344ff06
7d30779
6ca9231
c9d0f91
cfdc729
f056dc1
8926006
ccc6341
b83daa9
853aae9
91d61f0
b841b89
e44655e
a642882
ca3fae5
3b576b1
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
示例可以多举一个。比如 y = paddle.to_tensor([2],这样有broadcast的例子了
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.
已经添加好了~
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.
这样能保证,输入x的dtype是int,输出也是int类型么?
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.
不能,当时这么设置的原因在下面提到了
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.
而且还有一个问题就是,虽然x的dtype是int,y输入的dtype也是int,但y是负的,这时候输出类型也应该为float,所以我觉得输出类型设置为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.
这个不行,这不算支持int类型哈。
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.
这里的two, y为什么要cast成float64类型,用int类型也可以吧?
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.pow的时候,输入的是int类型时候,如果是负数的情况会发生精度损失,直接为0
下图为设置为int64的情况:
下图设置为float64的情况
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.
torch如果指数是负数,是不支持x是int的。可以提一个issue,说明下此处不一致。
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.
torch如果指数是负数的时候会报错,但如果指数为负数且是tensor的时候的时候是可以正常计算的,不过也是会发生相应的精度问题
