Dropout的作用:

CS231n 2016 通关 第五、六章 Dropout 作业

cell  1 - cell 2 依旧

cell 3 Dropout层的前向传播

  核心代码:

    train 时:

1   if mode == 'train':
2     ###########################################################################
3     # TODO: Implement the training phase forward pass for inverted dropout.   #
4     # Store the dropout mask in the mask variable.                            #
5     ###########################################################################
6     mask = (np.random.rand(*x.shape) < p) /p
7     out = x * mask

    test 时:

1     ###########################################################################
2   elif mode == 'test':
3     ###########################################################################
4     # TODO: Implement the test phase forward pass for inverted dropout.       #
5     ###########################################################################
6     out = x

  原理较为简单。

cell 4 反向传播:

  主要是计算偏导。

  核心代码:

1     dx = dout * mask    

cell 5 对全连接网络使用Dropout

  将相应的层加入到模型即可。

附:通关CS231n企鹅群:578975100 validation:DL-CS231n 

相关文章:

  • 2021-07-02
  • 2021-11-22
  • 2021-10-03
  • 2022-12-23
  • 2022-02-12
  • 2022-12-23
  • 2021-09-30
猜你喜欢
  • 2021-07-09
  • 2022-01-13
  • 2021-08-19
  • 2022-01-17
  • 2022-02-04
  • 2021-05-19
  • 2021-06-15
相关资源
相似解决方案