Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
d63ad8d5
提交
d63ad8d5
authored
5月 31, 2013
作者:
Olivier Delalleau
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Typo fixes
上级
e2c09157
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
12 行增加
和
12 行删除
+12
-12
nnet.txt
doc/library/tensor/nnet/nnet.txt
+7
-7
sigm.py
theano/tensor/nnet/sigm.py
+5
-5
没有找到文件。
doc/library/tensor/nnet/nnet.txt
浏览文件 @
d63ad8d5
...
...
@@ -15,8 +15,8 @@
:Parameters: *x* - symbolic Tensor (or compatible)
:Return type: same as x
:Returns: element-wise sigmoid: :math:`sigmoid(x) = \frac{1}{1 + \exp(-x)}`.
:note: see :func:`ultra_fast_sigmoid` or :func:`hard_sigmoid` for faster version.
Speed comparison for 100M float64 element
on a Core2 Duo @ 3.16 GHz.
:note: see :func:`ultra_fast_sigmoid` or :func:`hard_sigmoid` for faster version
s
.
Speed comparison for 100M float64 element
s on a Core2 Duo @ 3.16 GHz:
- hard_sigmoid: 1.0s
- ultra_fast_sigmoid: 1.3s
...
...
@@ -44,15 +44,15 @@
:Parameters: *x* - symbolic Tensor (or compatible)
:Return type: same as x
:Returns: approximated element-wise sigmoid: :math:`sigmoid(x) = \frac{1}{1 + \exp(-x)}`.
:note: To automatically change all :func:`sigmoid` op to this version, use
:note: To automatically change all :func:`sigmoid` op
s
to this version, use
the Theano optimization ``local_ultra_fast_sigmoid``. This can be done
with the Theano flag ``optimizer_including=local_ultra_fast_sigmoid``.
This optimization is done late, so it should
n'
t affect
This optimization is done late, so it should
no
t affect
stabilization optimization.
.. note:: The underlying code will return 0.00247262315663 as the
minimum value and 0.997527376843 as the maximum value. So it
never return 0 or 1.
never return
s
0 or 1.
...
...
@@ -63,10 +63,10 @@
:Parameters: *x* - symbolic Tensor (or compatible)
:Return type: same as x
:Returns: approximated element-wise sigmoid: :math:`sigmoid(x) = \frac{1}{1 + \exp(-x)}`.
:note: To automatically change all :func:`sigmoid` op to this version, use
:note: To automatically change all :func:`sigmoid` op
s
to this version, use
the Theano optimization ``local_hard_sigmoid``. This can be done
with the Theano flag ``optimizer_including=local_hard_sigmoid``.
This optimization is done late, so it should
n'
t affect
This optimization is done late, so it should
no
t affect
stabilization optimization.
.. note:: The underlying code will return an exact 0 or 1 if an
...
...
theano/tensor/nnet/sigm.py
浏览文件 @
d63ad8d5
...
...
@@ -98,7 +98,7 @@ for i in xrange(750):
// We block to keep the data in l1
// normal l1 size = 32k: 32k/2(input + output)/8(nb bytes of double)=2k
// We stay bellow the 2k limit to let space for
// This is faster th
e
n the not blocking version
// This is faster th
a
n the not blocking version
for(int i=0;i<n;i+=2048){
npy_intp nb = (n-i<2048)?n-i:2048;
for(int j=0;j<nb;j++){
...
...
@@ -261,16 +261,16 @@ theano.compile.optdb['uncanonicalize'].register("local_ultra_fast_sigmoid",
def
hard_sigmoid
(
x
):
"""An approximation of sigmoid.
More approximate and faster th
e
n ultra_fast_sigmoid.
More approximate and faster th
a
n ultra_fast_sigmoid.
Approx in 3 parts: 0, scaled linear, 1
Removing the slop
and shift don'
t make it faster.
Removing the slop
e and shift does no
t make it faster.
"""
slop
=
0.2
slop
e
=
0.2
shift
=
0.5
x
=
(
x
*
0.2
)
+
shift
x
=
(
x
*
slope
)
+
shift
x
=
tensor
.
clip
(
x
,
0
,
1
)
return
x
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论