>>> for t in scheduler.timesteps:
...     with torch.no_grad():
...         noisy_residual = model(input, t).sample
...     previous_noisy_sample = scheduler.step(noisy_residual, t, input).prev_sample
...     input = previous_noisy_sample
```  
This is the entire denoising process, and you can use this same pattern to write any diffusion system.  
6. The last step is to convert the denoised output into an image:  
```py
>>> from PIL import Image
>>> import numpy as np