forked from pytorch/pytorch
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JIT] Add
__prepare_scriptable__
duck typing to allow replacing nn.…
…modules with scriptable preparations (pytorch#45645) (pytorch#49242) Summary: Pull Request resolved: pytorch#49242 Fixes pytorch#45072 As discussed with zdevito gchanan cpuhrsch and suo, this change allows developers to create custom preparations for their modules before scripting. This is done by adding a `__prepare_scriptable__` method to a module which returns the prepared scriptable module out-of-place. It does not expand the API surface for end users. Prior art by jamesr66a: pytorch#42244 Test Plan: Imported from OSS Reviewed By: dongreenberg Differential Revision: D25500303 fbshipit-source-id: d3ec9005de27d8882fc29d02f0d08acd2a5c6b2c
- Loading branch information
Meghan Lele
authored and
hwangdeyu
committed
Jan 14, 2021
1 parent
e9af379
commit 3763093
Showing
3 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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