| 226 | |
| 227 | def test_train_eval(self): |
| 228 | class TestModel(torch.nn.Module): |
| 229 | def __init__(self): |
| 230 | super().__init__() |
| 231 | self.dropout = torch.nn.Dropout(p=1.0) |
| 232 | |
| 233 | def forward(self, x): |
| 234 | x = x.float().mean() |
| 235 | x = self.dropout(x) # dropout |
| 236 | if self.training: |
| 237 | x += 100 # add |
| 238 | else: |
| 239 | x *= 0 # mul |
| 240 | x -= 0 # sub |
| 241 | return x |
| 242 | |
| 243 | model = TestModel() |
| 244 |
no outgoing calls
searching dependent graphs…