x1=f1(x)
x2= checkpoint(f2,x1) #f2(x1)
x3=f3(x2)
Without checkpoint, x2.grad_fn may keep intermediate tensors created in f2() alive. With checkpoint, x2.grad_fn schedules re-run of f2 with “gradient tape”. Point of this is to have more free memory for f3().