Skip to content

Conversation

@jon-chuang
Copy link
Collaborator

Partial fix: #110606

More on has_complex shortcut: #110613 (comment)

CC: @janeyx99, @mlazos, @lezcano

@pytorch-bot
Copy link

pytorch-bot bot commented Oct 5, 2023

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/110631

Note: Links to docs will display an error until the docs builds have been completed.

✅ You can merge normally! (2 Unrelated Failures)

As of commit 0869902 with merge base cf1b494 (image):

UNSTABLE - The following jobs failed but were likely due to flakiness present on trunk and has been marked as unstable:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@albanD albanD removed their request for review October 5, 2023 18:27
@soulitzer soulitzer added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Oct 5, 2023
Copy link
Collaborator

@lezcano lezcano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that the pattern is the same in every optimiser, perhaps we want to factor it out into its own aux function?

@jon-chuang
Copy link
Collaborator Author

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Oct 6, 2023
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@lezcano
Copy link
Collaborator

lezcano commented Oct 6, 2023

@jon-chuang what about #110631 (review)?

@jon-chuang
Copy link
Collaborator Author

jon-chuang commented Oct 6, 2023

Hello, @lezcano I tried to respond at #110635 (comment)

As mentioned, we are limited by the functional APIs. Given that it is specific to each optimizer and only used in multi_tensor case, I'm not sure it makes sense to have an aux function as there will be no shared logic nor object-oriented abstraction

@jon-chuang
Copy link
Collaborator Author

jon-chuang commented Oct 6, 2023

Anw, I might have some idea about what you mean, I'll ping you once the PR is up.

I can try to have a generic helper function that accepts variadic number of lists

@lezcano
Copy link
Collaborator

lezcano commented Oct 6, 2023

I was thinking of something along the lines of

def view_as_real(*params):
    assert len(params) > 0
    n = len(params[0])
    assert all(len(p) == n for p in params)

    for i in range(n):
        p = params[0][i]
        if torch.is_complex(p):
            for p_list in params:
                p_list[i] = torch.view_as_real(p_list[i])

If there can be empty lists, you can filter them out first, of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged open source release notes: optim triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[optim]: NAdam, RAdam and _multi_tensor_adadelta do not support complex types

5 participants