Skip to content

[C++ API] Create Sequential::extend#9116

Closed
goldsborough wants to merge 1 commit intopytorch:masterfrom
goldsborough:extend
Closed

[C++ API] Create Sequential::extend#9116
goldsborough wants to merge 1 commit intopytorch:masterfrom
goldsborough:extend

Conversation

@goldsborough
Copy link
Contributor

There is no way to concatenate two Sequentials in Python, but it's also easier to do in an immutable fashion by just writing Sequential(first.modules() + second.modules()). Concatenating vectors isn't as easy in C++, so I think it's fair to save users some for loops by giving them Sequential::extend().

@apaszke @ebetica @ezyang

CC @jamespinkerton

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.

@goldsborough has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

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.

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

goodlux pushed a commit to goodlux/pytorch that referenced this pull request Aug 15, 2018
Summary:
There is no way to concatenate two `Sequential`s in Python, but it's also easier to do in an immutable fashion by just writing `Sequential(first.modules() + second.modules())`. Concatenating vectors isn't as easy in C++, so I think it's fair to save users some for loops by giving them `Sequential::extend()`.

apaszke ebetica ezyang

CC jamespinkerton
Closes pytorch#9116

Reviewed By: ezyang

Differential Revision: D8719630

Pulled By: goldsborough

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants