Implement RMS Normalization forward pass for 1D input vectors. Given an input tensor of shape [N] where N is the number of elements, compute the normalized output using a scalar scale (gamma) and shift (beta) parameter.
RMS Normalization computes: \[ \begin{align} \text{rms} &= \sqrt{\frac{1}{N} \sum_{i=1}^{N} x_i^2 + \epsilon} \\ \hat{x}_i &= \frac{x_i}{\text{rms}} \\ y_i &= \gamma \hat{x}_i + \beta \end{align} \]
solve function signature must remain unchangedoutput tensor
Input: input = [1.0, 2.0, 3.0, 4.0] (N=4)
gamma = 1.0
beta = 0.0
eps = 1e-5
Output: output = [0.36514813, 0.73029625, 1.0954444, 1.4605925 ]
Input: input = [1.0, 2.0, 3.0] (N=3)
gamma = 1.0
beta = 0.0
eps = 1e-5
Output: output = [0.46290955, 0.9258191, 1.3887286]
N ≤ 100,000eps = 1e-5N = 100,000