Created
November 20, 2020 00:05
-
-
Save rohan-varma/19af18ebadb54a4deb4fbfa1e82dde01 to your computer and use it in GitHub Desktop.
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
class MyModule(torch.jit.ScriptModule): | |
def __init__(self): | |
super().__init__() | |
@torch.jit.script_method | |
def method(self, x): | |
return x | |
def forward(self) -> Tensor: | |
res_tensor = torch.ones(2, 2) | |
return self.method(res_tensor) | |
@torch.jit.script | |
def construct_my_script_module() -> torch.jit.ScriptModule: | |
return MyModule() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment