-
Notifications
You must be signed in to change notification settings - Fork 666
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 op remainder #9869
Open
youxiudeshouyeren
wants to merge
15
commits into
Oneflow-Inc:master
Choose a base branch
from
youxiudeshouyeren:add_op_remainder
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add op remainder #9869
youxiudeshouyeren
wants to merge
15
commits into
Oneflow-Inc:master
from
youxiudeshouyeren:add_op_remainder
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
youxiudeshouyeren
requested review from
doombeaker,
hjchen2,
BBuf,
jackalcooper and
daquexian
as code owners
February 17, 2023 13:48
dim2 = random().to(int) | ||
input = random_tensor(ndim=3, dim1=dim1, dim2=dim2).to(device) | ||
other = random_tensor(ndim=3, dim1=dim1, dim2=dim2).to(device) | ||
return torch.remainder(input, other) |
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.
这个测试在CI报错,在我本地运行了2/30次也没有复现出来。之前有一个global测试也在CI挂了,但是可在本地复现出来,代码如下:debug出来是梯度不相等,在shape为(16, 16, 24, 24)的grad中,有一个位置的值不相等,分别是[-221.3744],[-222.08623]。这个bug不是每次都出现,但是报错后打印出的梯度都是只有一个地方的值不相等,所以应该不是梯度代码写的有问题。不太清楚是哪里有问题
@autotest(n=1, rtol=1e-3, atol=1e-2, auto_backward=True, check_graph=False)
def do_test_remainder_impl(test_case, ndim, placement, sbp):
dims = [random(1, 4) * 8 for i in range(ndim)]
x = random_tensor(ndim, *dims)
x = x.to_global(placement=placement, sbp=sbp)
y = random_tensor(ndim, *dims)
y = y.to_global(placement=placement, sbp=sbp)
z = torch.remainder(x, y)
return z
class TestRemainderGlobal(flow.unittest.TestCase):
@globaltest
def test_remainder(test_case):
ndim = random(1, 4).to(int).value()
for placement in all_placement():
for sbp in all_sbp(placement, max_dim=ndim):
do_test_remainder_impl(test_case, ndim, placement, sbp)
if __name__ == "__main__":
unittest.main()
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
对接torch.remainder
https://pytorch.org/docs/stable/generated/torch.remainder.html?highlight=remainder#torch.remainder