| 323 | import torch.nn as nn |
| 324 | |
| 325 | class Model(nn.Module): |
| 326 | def __init__(self): |
| 327 | super().__init__() |
| 328 | self.w = nn.Parameter(torch.randn(5)) |
| 329 | |
| 330 | def forward(self, x): |
| 331 | with torch.autograd.graph.save_on_cpu(pin_memory=True): |
| 332 | # some computation |
| 333 | return self.w * x |
| 334 | |
| 335 | x = torch.randn(5) |
| 336 | model = Model() |
no outgoing calls
no test coverage detected