| 21 | |
| 22 | |
| 23 | class EvalModeForLoadedModule(FileSetup): |
| 24 | path = 'dropout_model.pt' |
| 25 | |
| 26 | def setup(self): |
| 27 | class Model(torch.jit.ScriptModule): |
| 28 | def __init__(self): |
| 29 | super().__init__() |
| 30 | self.dropout = torch.nn.Dropout(0.1) |
| 31 | |
| 32 | @torch.jit.script_method |
| 33 | def forward(self, x): |
| 34 | x = self.dropout(x) |
| 35 | return x |
| 36 | |
| 37 | model = Model() |
| 38 | model = model.train() |
| 39 | model.save(self.path) |
| 40 | |
| 41 | |
| 42 | class SerializationInterop(FileSetup): |
no outgoing calls
no test coverage detected
searching dependent graphs…