Skip to content

Conversation

@jamesr66a
Copy link
Collaborator

@jamesr66a jamesr66a commented Jun 16, 2019

Stack from ghstack:

Differential Revision: D15860002

@pytorchbot pytorchbot added oncall: jit Add this issue/PR to JIT oncall triage queue module: internals Related to internal abstractions in c10 and ATen module: pybind Related to our Python bindings / interactions with other Python libraries labels Jun 16, 2019
@jamesr66a jamesr66a requested review from suo and zdevito and removed request for suo June 17, 2019 17:20
James Reed added 7 commits June 17, 2019 10:49
[JIT] NamedTuple serialization

gh-metadata: pytorch pytorch 21839 gh/jamesr66a/6/head
[JIT] NamedTuple serialization

gh-metadata: pytorch pytorch 21839 gh/jamesr66a/6/head
[JIT] NamedTuple serialization

gh-metadata: pytorch pytorch 21839 gh/jamesr66a/6/head
[JIT] NamedTuple serialization

gh-metadata: pytorch pytorch 21839 gh/jamesr66a/6/head
[JIT] NamedTuple serialization

gh-metadata: pytorch pytorch 21839 gh/jamesr66a/6/head
[JIT] NamedTuple serialization

gh-metadata: pytorch pytorch 21839 gh/jamesr66a/6/head
[JIT] NamedTuple serialization

gh-metadata: pytorch pytorch 21839 gh/jamesr66a/6/head
Copy link
Contributor

@zdevito zdevito left a comment

Choose a reason for hiding this comment

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

This looks pretty good. Let's coordinate a few things tomorrow morning to make sure it works for both Interfaces and NamedTuples

auto fullName = c10::QualifiedName(basename_, name);
if (auto classType = cu_.get_class(fullName)) {
return std::make_shared<ClassValue>(classType);
if (auto serializable_type = cu_.get_serializable_type(fullName)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is going to conflict with #21853 which also needs to redefine how named types are put in the compilation unit.


TypePtr resolveType(const std::string& name, const SourceRange& loc) const override {
return lib_cu_.get_class(c10::QualifiedName(name));
return lib_cu_.get_serializable_type(c10::QualifiedName(name));
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, we should coordinate how this will work across interfaces and named tuples, both require extending this API.

L.reportError(
"Inheritance is not yet supported for TorchScript classes yet.");
// Only support inheriting from NamedTuple right now.
if (L.nextIf(TK_NAMED_TUPLE)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

L.nextIf(TK_IDENT).value() == "NamedTuple"

James Reed added 6 commits June 18, 2019 12:12
[JIT] NamedTuple serialization

gh-metadata: pytorch pytorch 21839 gh/jamesr66a/6/head
[JIT] NamedTuple serialization

gh-metadata: pytorch pytorch 21839 gh/jamesr66a/6/head
[JIT] NamedTuple serialization

gh-metadata: pytorch pytorch 21839 gh/jamesr66a/6/head
[JIT] NamedTuple serialization

gh-metadata: pytorch pytorch 21839 gh/jamesr66a/6/head
[JIT] NamedTuple serialization

gh-metadata: pytorch pytorch 21839 gh/jamesr66a/6/head
[JIT] NamedTuple serialization

gh-metadata: pytorch pytorch 21839 gh/jamesr66a/6/head
@pytorchbot pytorchbot added the module: cpp Related to C++ API label Jun 19, 2019
@jamesr66a jamesr66a requested a review from zdevito June 19, 2019 03:40
Copy link
Contributor

@zdevito zdevito left a comment

Choose a reason for hiding this comment

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

Looks good!

auto fullName = c10::QualifiedName(basename_, name);
if (auto classType = cu_.get_class(fullName)) {
return std::make_shared<ClassValue>(classType);
if (auto serializable_type = cu_.get_serializable_type(fullName)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

get_serializabe_type -> get_type

James Reed added 2 commits June 18, 2019 22:14
[JIT] NamedTuple serialization

gh-metadata: pytorch pytorch 21839 gh/jamesr66a/6/head
[JIT] NamedTuple serialization

gh-metadata: pytorch pytorch 21839 gh/jamesr66a/6/head
@zou3519 zou3519 deleted the gh/jamesr66a/6/head branch June 19, 2019 17:46
zdevito pushed a commit to zdevito/ATen that referenced this pull request Jun 19, 2019
Summary:
Pull Request resolved: pytorch/pytorch#21839
ghimport-source-id: b9d82018fbf26b22d58cad3a033cbfe4e879a8fe

Test Plan: Imported from OSS

Reviewed By: zdevito

Differential Revision: D15860002

Pulled By: jamesr66a

fbshipit-source-id: 0fc97c4adefa9ae4937f21179c7afa817f4099e5
@facebook-github-bot
Copy link
Contributor

@jamesr66a merged this pull request in dd046be.

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: internals Related to internal abstractions in c10 and ATen module: pybind Related to our Python bindings / interactions with other Python libraries oncall: jit Add this issue/PR to JIT oncall triage queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants