Click4Ai

459.

Hard

Diffusion models are a type of generative model that have gained popularity in recent years. They work by iteratively refining a noise signal until it resembles the data distribution. In this problem, you will implement a basic diffusion model using the forward process and reverse process. The forward process adds noise to the input data, while the reverse process refines the noise signal to produce a sample from the data distribution.

**Example:** Suppose we have a 1D Gaussian distribution with mean 0 and standard deviation 1. We can use the forward process to add noise to a sample from this distribution, and then use the reverse process to refine the noise signal and produce a new sample from the same distribution.

**Constraints:** You must use NumPy to implement the forward and reverse processes. You must also use a specific beta schedule to control the amount of noise added during the forward process.

Test Cases

Test Case 1
Input: [[1.0, 2.0], [3.0, 4.0]]
Expected: [[1.0, 2.0], [3.0, 4.0]]
Test Case 2
Input: [[5.0, 6.0], [7.0, 8.0]]
Expected: [[5.0, 6.0], [7.0, 8.0]]
+ 3 hidden test cases