Skip to content

Conversation

@MJ10
Copy link
Contributor

@MJ10 MJ10 commented Sep 12, 2019

Adds support for the Bilinear layer to the C++ frontend

@yf225
Copy link
Contributor

yf225 commented Sep 12, 2019

@MJ10 Thanks a lot for the PR! We might need to remove the changes in third_party/fbgemm because they are unrelated and likely due to out-of-sync submodule.

@MJ10
Copy link
Contributor Author

MJ10 commented Sep 12, 2019

@yf225 thanks for pointing that out! I've removed it.

@yf225
Copy link
Contributor

yf225 commented Sep 12, 2019

@MJ10
Copy link
Contributor Author

MJ10 commented Sep 12, 2019

@yf225 it's already enabled

@pytorch pytorch deleted a comment from pytorchbot Oct 3, 2019
@pytorch pytorch deleted a comment from pytorchbot Oct 3, 2019
@jerryzh168 jerryzh168 added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Oct 5, 2019
@MJ10
Copy link
Contributor Author

MJ10 commented Oct 7, 2019

@yf225 do let me know if any changes are required, would be happy to update this PR :)

Copy link
Contributor

@yf225 yf225 left a comment

Choose a reason for hiding this comment

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

@MJ10 Thanks so much for the contribution and my sincere apologies for the delay. :( The folder structure of C++ torch::nn modules have changed considerably in the past few weeks, and we have finally settled down on the design. I believe we can easily move this PR to the new design and will be able to merge it very soon. :) Thanks again!

class TORCH_API BilinearImpl : public Cloneable<BilinearImpl> {
public:
BilinearImpl(int64_t in1, int64_t in2, int64_t out) : BilinearImpl(BilinearOptions(in1, in2, out)) {}
explicit BilinearImpl(BilinearOptions options);
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be awesome to change this to

Suggested change
explicit BilinearImpl(BilinearOptions options);
explicit BilinearImpl(const BilinearOptions& options_);

to match the design of other torch::nn modules.

@MJ10
Copy link
Contributor Author

MJ10 commented Oct 10, 2019

@yf225 Thanks for the detailed comments! Apologies I couldn't follow the change in the design apologies for the delay. I've made the requested changes.

Copy link
Contributor

@yf225 yf225 left a comment

Choose a reason for hiding this comment

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

Thanks so much for the changes @MJ10! I left some comments, and we should be able to merge this PR very soon :D


void BilinearImpl::reset() {
weight =
register_parameter("weight", torch::empty({options.out_features_, options.in1_features_, options.in2_features_}));
Copy link
Contributor

Choose a reason for hiding this comment

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

options.name_ are private now and we would need to change it to options.name(). (For example, options.out_features_ would be options.out_features().)

@yf225
Copy link
Contributor

yf225 commented Oct 10, 2019

@MJ10 I fixed a code conflict using the github code editor, and I believe we would need to pull from the remote branch first. :D


BilinearOptions::BilinearOptions(int64_t in1_features, int64_t in2_features, int64_t out_features) : in1_features_(in1_features), in2_features_(in2_features), out_features_(out_features) {}

BilinearImpl::BilinearImpl(BilinearOptions options) : options(options) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We would need to also change this to:

Suggested change
BilinearImpl::BilinearImpl(BilinearOptions options) : options(options) {
BilinearImpl::BilinearImpl(const BilinearOptions& options_) : options(options_) {

@yf225
Copy link
Contributor

yf225 commented Oct 11, 2019

@pytorchbot rebase this please

@yf225
Copy link
Contributor

yf225 commented Oct 15, 2019

This is blocked by #27948. I will merge that PR as soon as possible to unblock this.

@MJ10
Copy link
Contributor Author

MJ10 commented Oct 15, 2019

Thanks a lot @yf225 !

facebook-github-bot pushed a commit that referenced this pull request Oct 15, 2019
Summary:
C++ API `Module::register_parameter` should accept undefined Tensor as parameter, which is equivalent to `module.register_parameter("param", None)` in Python API.

This unblocks #26082 and #27156.
Pull Request resolved: #27948

Differential Revision: D17931739

Pulled By: yf225

fbshipit-source-id: 21bdfc88e66e3dc39f3caf608a6a3de48c510fa9
@yf225
Copy link
Contributor

yf225 commented Oct 16, 2019

@pytorchbot rebase this please

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@yf225 is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@yf225 merged this pull request in f38beff.

@MJ10
Copy link
Contributor Author

MJ10 commented Oct 16, 2019

Thanks a lot for all the help @yf225

thiagocrepaldi pushed a commit to thiagocrepaldi/pytorch that referenced this pull request Feb 4, 2020
…#27948)

Summary:
C++ API `Module::register_parameter` should accept undefined Tensor as parameter, which is equivalent to `module.register_parameter("param", None)` in Python API.

This unblocks pytorch#26082 and pytorch#27156.
Pull Request resolved: pytorch#27948

Differential Revision: D17931739

Pulled By: yf225

fbshipit-source-id: 21bdfc88e66e3dc39f3caf608a6a3de48c510fa9
thiagocrepaldi pushed a commit to thiagocrepaldi/pytorch that referenced this pull request Feb 4, 2020
Summary:
Adds support for the Bilinear layer to the C++ frontend
Pull Request resolved: pytorch#26082

Differential Revision: D17954148

Pulled By: yf225

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

Labels

Merged module: cpp Related to C++ API module: third_party open source 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.

7 participants