Skip to content

Instantly share code, notes, and snippets.

@wanchaol
Last active November 28, 2018 19:56
Show Gist options
  • Save wanchaol/2c48b3c61e97fda1ea61f7389d77b2ec to your computer and use it in GitHub Desktop.
Save wanchaol/2c48b3c61e97fda1ea61f7389d77b2ec to your computer and use it in GitHub Desktop.
import torch
class Test(torch.jit.ScriptModule):
def __init__(self, b = None):
self.b = b
def forward(self, input):
x = input
if self.b is not None:
x = self.b(input)
return x
Test()(torch.randn(2, 3))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment