The "ReQU" unit
2015-08-17 15:22
169 查看
Here, we’ll implement a made-up activation function that we’ll call the Rectified Quadratic Unit(ReQU). Like the sigmoid and ReLU and several others, it is applied element-wise to all its inputs:
zi=I[xi>0]x2i={x2i0if xi>0otherwise
zi=I[xi>0]x2i={x2i0if xi>0otherwise
require 'nn' local ReQU = torch.class('nn.ReQU', 'nn.Module') function ReQU:updateOutput(input) -- TODO self.output:resizeAs(input):copy(input) self.output[torch.lt(self.output, 0)] = 0 self.output:pow(2) -- ...something here... return self.output end function ReQU:updateGradInput(input, gradOutput) -- TODO self.gradInput:resizeAs(gradOutput):copy(gradOutput) self.gradInput[torch.lt(input, 0)] = 0 self.gradInput:mul(2):cmul(input) -- ...something here... return self.gradInput end
相关文章推荐
- mysql_fetch_assoc()的错误提示及其他
- 03-iptables-实验
- 禁止QQ自动转义表情字符
- JAVA开发编码全解析(一)----编码的由来和种类
- Nginx---基础知识. Nginx特色
- JQuery EasyUI DataGrid 获取属性值
- 近期计划
- sublime text 3在windows中配置ctags插件
- python 逻辑回归 程序解析
- 慕课玩儿转swift笔记01
- 将图像旋转90度
- 黑马程序员-[C语言] 第一篇:运算符、程序结构总结
- 使用vmstat,iostat查看系统性能
- 应用before/after伪类时如何CSS命名以及针对ie6/ie7浏览器兼容
- Spring依赖注入:注解注入
- caffe源码解析 — net.cpp
- python2.7学习笔记(6) ——高级特性:切片、迭代、列表生成式、生成器
- C语言求最小公倍数和最大公约数三种算法
- Linux下SVG浏览存在问题及解决方法
- 粒子系统实现要点。