Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up[C++ Frontend] Kaiming Initialization #14718
Conversation
JoshVarty
added some commits
Dec 3, 2018
JoshVarty
requested review from
ebetica
and
goldsborough
as
code owners
Dec 3, 2018
vishwakftw
reviewed
Dec 4, 2018
torch/csrc/api/src/nn/init.cpp Outdated
vishwakftw
reviewed
Dec 4, 2018
torch/csrc/api/src/nn/init.cpp Outdated
vishwakftw
reviewed
Dec 4, 2018
torch/csrc/api/src/nn/init.cpp Outdated
goldsborough
reviewed
Dec 4, 2018
When you build PyTorch from source (see CONTRIBUTING.md), there will be a |
torch/csrc/api/src/nn/init.cpp Outdated
torch/csrc/api/src/nn/init.cpp Outdated
torch/csrc/api/src/nn/init.cpp Outdated
torch/csrc/api/src/nn/init.cpp Outdated
goldsborough
changed the title
WIP: Kaiming Initialization for C++ API
[WIP][C++ Frontend] Kaiming Initialization
Dec 4, 2018
goldsborough
added
the
cpp
label
Dec 4, 2018
JoshVarty
added some commits
Dec 4, 2018
This comment has been minimized.
This comment has been minimized.
Hi @goldsborough, any update on this PR? |
This comment has been minimized.
This comment has been minimized.
Sorry for the delay, I've made the changes but haven't quite figured out how to run the tests. I'll try to get them running ASAP. I'd be interested in adding tests to this PR. |
This comment has been minimized.
This comment has been minimized.
@JoshVarty where are you getting stuck? Have you located the |
This comment has been minimized.
This comment has been minimized.
@goldsborough I can't seem to find the binary, but I do see a folder called I'm running:
Which returns:
P.S. I believe there's a PyTorch Slack right? If it's easier, we could discuss this build stuff there. I sent a couple emails to slack@pytorch.org last week but I haven't heard back. |
This comment has been minimized.
This comment has been minimized.
You should run |
This comment has been minimized.
This comment has been minimized.
I wanted to reimplement these tests in C++ but I'm having trouble because those tests use Is there a similar implementation in C++? Or would I essentially be looking at re-implementing this SciPy functionality? If I'd have to reimplement it, it may be better to create a new issue and discuss that approach there. One positive is that it would also allow us to test the |
goldsborough
reviewed
Dec 7, 2018
test/cpp/api/misc.cpp Outdated
This comment has been minimized.
This comment has been minimized.
@JoshVarty One thing you can do is verify that the output in C++ matches that in Python. We do this for the optimizers for example: https://github.com/pytorch/pytorch/blob/master/test/cpp/api/optim_baseline.py For this, you'd write a small PyTorch script that generates a C++ header file containing some constants for every test case, and then include that header in the C++ test file, and compare the output of the same code in C++ to the Python outputs you generated. What do you think of this idea? |
goldsborough
reviewed
Dec 7, 2018
torch/csrc/api/src/nn/init.cpp Outdated
torch/csrc/api/src/nn/init.cpp Outdated
JoshVarty
added some commits
Dec 7, 2018
This comment has been minimized.
This comment has been minimized.
@goldsborough is this ready to go? |
This comment has been minimized.
This comment has been minimized.
@ezyang It is not because there are no tests yet. @JoshVarty are you still interested in wrapping up this PR by adding some tests? It looks great so far, thanks for your work. |
This comment has been minimized.
This comment has been minimized.
Yeah I would like to add the tests. I haven't had much time to look at this over the holidays but I anticipate I'll have some free time this week to look at it again. |
JoshVarty
requested a review
from
yf225
as a
code owner
Jan 29, 2019
This comment has been minimized.
This comment has been minimized.
@fmassa If you guys are comfortable writing the tests, feel free. I haven't been able to build since merging master into this branch and can't seem to figure out what's wrong. :( |
This comment has been minimized.
This comment has been minimized.
@JoshVarty What do your build failures look like? If all else fails re-cloning your fork and re-building from scratch should work. |
This comment has been minimized.
This comment has been minimized.
I'm not sure why but for some reason it no longer builds. What I'm running is:
(I should note that I get the same errors when trying to build current pytorch master.) After compiling 56% of the project I get the following:
I'm not sure why it stopped working on my machine once I pulled in master, perhaps I changed something locally with my build tools but it was working because certain build steps were cached before? |
This comment has been minimized.
This comment has been minimized.
ShahriarSS
commented
Feb 1, 2019
Hi. |
This comment has been minimized.
This comment has been minimized.
I wiped my Ubuntu partition and started from scratch and that seems to have got everything working again. I've started the baselines and will create the C++ tests shortly. |
JoshVarty
added some commits
Feb 3, 2019
This comment has been minimized.
This comment has been minimized.
@JoshVarty Could you pull master into your branch to fix the macos test errors? Thanks :) |
This comment has been minimized.
This comment has been minimized.
@yf225 I merged |
This comment has been minimized.
This comment has been minimized.
@JoshVarty the current CI errors are unrelated and can be ignored @goldsborough @fmassa do you think the tests look good and the PR is ready to go? |
goldsborough
approved these changes
Feb 7, 2019
Looks great @JoshVarty, thanks! I left a few comments on things that could be improved, like the lambdas in |
test/cpp/api/init.cpp Outdated
test/cpp/api/init.cpp Outdated
test/cpp/api/init.cpp Outdated
test/cpp/api/misc.cpp Outdated
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@goldsborough This is probably good for another review if you get a minute. I think the only outstanding issue is my comment/question about how to handle the lambdas. |
This comment has been minimized.
This comment has been minimized.
Looks great, I'll land it tomorrow. Thanks again! |
facebook-github-bot
reviewed
Feb 12, 2019
@goldsborough is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
goldsborough
changed the title
[WIP][C++ Frontend] Kaiming Initialization
[C++ Frontend] Kaiming Initialization
Feb 15, 2019
facebook-github-bot
reviewed
Feb 15, 2019
@goldsborough is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
facebook-github-bot
reviewed
Feb 15, 2019
@goldsborough is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
JoshVarty commentedDec 3, 2018
/cc @goldsborough
Working on #14582
The corresponding python implementations are at: pytorch/torch/nn/init.py
Here is my initial implementation of Kaiming Initialization. I have not been able to figure out how to successfully run tests locally so I haven't added any yet.
A couple questions:
python setup.py test
? Can I run just a subset of the tests somehow?