CS 231n Assignment 2 Q2 CS学习笔记
发布时间
阅读量:
阅读量
Batch Normalization
- Forward
- Backward
- Layer Normalization
Forward
第个小问题是要求我们实现Batch Normalization层的前向传播过程。具体来说,我们需要对输入的一批样本数据计算其均值与方差,随后将这些统计结果用于对数据进行标准化处理,最后别忘了在标准化之后再加上一定的偏移量以恢复缩放效应。代码如下:
def batchnorm_forward(x, gamma, beta, bn_param):
"""
Forward pass for batch normalization.
During training the sample mean and (uncorrected) sample variance are
computed from minibatch statistics and used to normalize the incoming data.
During training we also keep an exponentially decaying running mean of the
mean and variance of each feature, and
全部评论 (0)
还没有任何评论哟~
