Skip to content

Conversation

@albanD
Copy link
Collaborator

@albanD albanD commented Oct 23, 2019

Stack from ghstack:

Fix #28370 repro

Differential Revision: D18251533

@albanD
Copy link
Collaborator Author

albanD commented Oct 23, 2019

Runtime tests:

import torch
import time

def run(val):
    print("Running with: ", val)
    weights = torch.rand(100, 64, requires_grad=True)
    inp = torch.rand(val).mul(100).long()
    with torch.no_grad():
        start = time.time()
        torch.embedding_renorm_(weights, inp, 1.0, 2)
        end = time.time()
    print("Time: ", end - start)

run(10)
run(999)
run(1001)
run(10000)
run(100000)

Before this patch:

Running with:  10
Time:  0.0020928382873535156
Running with:  999
Time:  0.01746654510498047
Running with:  1001
Time:  0.022373199462890625
Running with:  10000
Time:  0.024911165237426758
Running with:  100000
Time:  0.06808781623840332

After this patch:

Running with:  10
Time:  0.002100229263305664
Running with:  999
Time:  0.016559600830078125
Running with:  1001
Time:  0.01679515838623047
Running with:  10000
Time:  0.01960587501525879
Running with:  100000
Time:  0.05682206153869629

albanD added a commit to albanD/pytorch that referenced this pull request Oct 23, 2019
ghstack-source-id: ec2c403
Pull Request resolved: pytorch#28546
albanD added a commit that referenced this pull request Oct 23, 2019
ghstack-source-id: 02fa84f
Pull Request resolved: #28546
@facebook-github-bot
Copy link
Contributor

@albanD merged this pull request in a5d65d1.

zdevito pushed a commit to zdevito/ATen that referenced this pull request Nov 1, 2019
Summary:
Pull Request resolved: pytorch/pytorch#28546

Fix #28370 repro

Test Plan: Imported from OSS

Differential Revision: D18251533

Pulled By: albanD

fbshipit-source-id: cd9ab609797b8c887ec9128752cc6a2f58a9aee6
auto scale = max_norm / (norm + 1e-7);
row *= scale;
}
for (auto i = 0; i < num_indices; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

you should comment this -- it would be totally sensible for someone to not realize what's going on here and change it back.

@facebook-github-bot facebook-github-bot deleted the gh/albanD/10/head branch November 4, 2019 15:15
facebook-github-bot pushed a commit that referenced this pull request Dec 11, 2019
Summary:
Address last comment in #28546
Pull Request resolved: #29140

Differential Revision: D18915091

Pulled By: albanD

fbshipit-source-id: 756ff5bb6a92d47c80aa9f96ff6f0edea5fd24de
wuhuikx pushed a commit to wuhuikx/pytorch that referenced this pull request Jan 30, 2020
Summary:
Address last comment in pytorch#28546
Pull Request resolved: pytorch#29140

Differential Revision: D18915091

Pulled By: albanD

fbshipit-source-id: 756ff5bb6a92d47c80aa9f96ff6f0edea5fd24de
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants