zoukankan      html  css  js  c++  java
  • CS231n 2016 通关 第五、六章 Dropout 作业

    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 

  • 相关阅读:
    使用反射调用某个类的成员方法
    java反射机制
    SVProgressHUD
    __objc__
    loadView
    v2ex 下拉刷新 SCRootViewController
    stuck with
    v2ex 下拉刷新模块
    转载
    vue-cli脚手架构建了项目如何去除Eslint验证(语法格式验证)
  • 原文地址:https://www.cnblogs.com/wangxiu/p/5689840.html
Copyright © 2011-2022 走看看