Use static type information to restore type tags#25447
Closed
zdevito wants to merge 10 commits intogh/zdevito/102/basefrom
Closed
Use static type information to restore type tags#25447zdevito wants to merge 10 commits intogh/zdevito/102/basefrom
zdevito wants to merge 10 commits intogh/zdevito/102/basefrom
Conversation
When we unpickle IValues, we lose type information for List[T] and Dict[K, V]. We can restore this information using the static type information contained in the top-level Module/Class type. This ensures that even after serialization we can always get the dynamic type of an ivalue using its type() method.
This was referenced Aug 30, 2019
Use static type information to restore type tags When we unpickle IValues, we lose type information for List[T] and Dict[K, V]. We can restore this information using the static type information contained in the top-level Module/Class type. This ensures that even after serialization we can always get the dynamic type of an ivalue using its type() method. gh-metadata: pytorch pytorch 25447 gh/zdevito/102/head
Use static type information to restore type tags When we unpickle IValues, we lose type information for List[T] and Dict[K, V]. We can restore this information using the static type information contained in the top-level Module/Class type. This ensures that even after serialization we can always get the dynamic type of an ivalue using its type() method. emitModuleHook now has a check that the tags in saved/load modules are the same. gh-metadata: pytorch pytorch 25447 gh/zdevito/102/head
Use static type information to restore type tags When we unpickle IValues, we lose type information for List[T] and Dict[K, V]. We can restore this information using the static type information contained in the top-level Module/Class type. This ensures that even after serialization we can always get the dynamic type of an ivalue using its type() method. emitModuleHook now has a check that the tags in saved/load modules are the same. gh-metadata: pytorch pytorch 25447 gh/zdevito/102/head
Use static type information to restore type tags When we unpickle IValues, we lose type information for List[T] and Dict[K, V]. We can restore this information using the static type information contained in the top-level Module/Class type. This ensures that even after serialization we can always get the dynamic type of an ivalue using its type() method. emitModuleHook now has a check that the tags in saved/load modules are the same. gh-metadata: pytorch pytorch 25447 gh/zdevito/102/head
Use static type information to restore type tags When we unpickle IValues, we lose type information for List[T] and Dict[K, V]. We can restore this information using the static type information contained in the top-level Module/Class type. This ensures that even after serialization we can always get the dynamic type of an ivalue using its type() method. emitModuleHook now has a check that the tags in saved/load modules are the same. gh-metadata: pytorch pytorch 25447 gh/zdevito/102/head
This was referenced Sep 11, 2019
Use static type information to restore type tags When we unpickle IValues, we lose type information for List[T] and Dict[K, V]. We can restore this information using the static type information contained in the top-level Module/Class type. This ensures that even after serialization we can always get the dynamic type of an ivalue using its type() method. emitModuleHook now has a check that the tags in saved/load modules are the same. gh-metadata: pytorch pytorch 25447 gh/zdevito/102/head
suo
approved these changes
Sep 17, 2019
Member
suo
left a comment
There was a problem hiding this comment.
ngnt, just want more comments for posterity
| TypePtr keyType() const; | ||
| TypePtr valueType() const; | ||
|
|
||
| void unsafeSetKeyType(TypePtr t); |
Member
There was a problem hiding this comment.
can you add a comment explaining where this is used (and why not to use it in other circumstances)?
|
|
||
| TypePtr elementType() const; | ||
|
|
||
| void unsafeSetElementType(TypePtr t); |
| } | ||
| } | ||
|
|
||
| static void restoreAccurateTypeTagsIfPossible(const IValue& root) { |
Member
There was a problem hiding this comment.
Can we add a comment explaining what this is for? What happens if restoring accurate type tags is not possible? The name alone is so tantalizing and full of mystery!
Use static type information to restore type tags When we unpickle IValues, we lose type information for List[T] and Dict[K, V]. We can restore this information using the static type information contained in the top-level Module/Class type. This ensures that even after serialization we can always get the dynamic type of an ivalue using its type() method. emitModuleHook now has a check that the tags in saved/load modules are the same. gh-metadata: pytorch pytorch 25447 gh/zdevito/102/head
Use static type information to restore type tags When we unpickle IValues, we lose type information for List[T] and Dict[K, V]. We can restore this information using the static type information contained in the top-level Module/Class type. This ensures that even after serialization we can always get the dynamic type of an ivalue using its type() method. emitModuleHook now has a check that the tags in saved/load modules are the same. gh-metadata: pytorch pytorch 25447 gh/zdevito/102/head
Use static type information to restore type tags When we unpickle IValues, we lose type information for List[T] and Dict[K, V]. We can restore this information using the static type information contained in the top-level Module/Class type. This ensures that even after serialization we can always get the dynamic type of an ivalue using its type() method. emitModuleHook now has a check that the tags in saved/load modules are the same. gh-metadata: pytorch pytorch 25447 gh/zdevito/102/head
zdevito
added a commit
to zdevito/ATen
that referenced
this pull request
Sep 19, 2019
Summary: Pull Request resolved: pytorch/pytorch#25447 When we unpickle IValues, we lose type information for List[T] and Dict[K, V]. We can restore this information using the static type information contained in the top-level Module/Class type. This ensures that even after serialization we can always get the dynamic type of an ivalue using its type() method. Test Plan: Imported from OSS Differential Revision: D17127872 Pulled By: zdevito fbshipit-source-id: 1ffb5e37a7c35c71ac9d3fb7b2edbc7ce3fbec72
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack from ghstack:
When we unpickle IValues, we lose type information for List[T]
and Dict[K, V]. We can restore this information using the static
type information contained in the top-level Module/Class type.
This ensures that even after serialization we can always get the
dynamic type of an ivalue using its type() method.
Differential Revision: D17127872