(ctx, run_function, length, *args)
| 34 | class CheckpointFunction(torch.autograd.Function): |
| 35 | @staticmethod |
| 36 | def forward(ctx, run_function, length, *args): |
| 37 | ctx.run_function = run_function |
| 38 | ctx.input_tensors = list(args[:length]) |
| 39 | ctx.input_params = list(args[length:]) |
| 40 | ctx.gpu_autocast_kwargs = {"enabled": torch.is_autocast_enabled(), |
| 41 | "dtype": torch.get_autocast_gpu_dtype(), |
| 42 | "cache_enabled": torch.is_autocast_cache_enabled()} |
| 43 | with torch.no_grad(): |
| 44 | output_tensors = ctx.run_function(*ctx.input_tensors) |
| 45 | return output_tensors |
| 46 | |
| 47 | @staticmethod |
| 48 | def backward(ctx, *output_grads): |
nothing calls this directly
no outgoing calls
no test coverage detected