(ctx, run_function, length, *args)
| 119 | class CheckpointFunction(torch.autograd.Function): |
| 120 | @staticmethod |
| 121 | def forward(ctx, run_function, length, *args): |
| 122 | ctx.run_function = run_function |
| 123 | ctx.input_tensors = list(args[:length]) |
| 124 | ctx.input_params = list(args[length:]) |
| 125 | ctx.gpu_autocast_kwargs = {"enabled": torch.is_autocast_enabled(), |
| 126 | "dtype": torch.get_autocast_gpu_dtype(), |
| 127 | "cache_enabled": torch.is_autocast_cache_enabled()} |
| 128 | with torch.no_grad(): |
| 129 | output_tensors = ctx.run_function(*ctx.input_tensors) |
| 130 | return output_tensors |
| 131 | |
| 132 | @staticmethod |
| 133 | def backward(ctx, *output_grads): |
nothing calls this directly
no outgoing calls
no test coverage detected