Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
200babca
提交
200babca
authored
5月 03, 2016
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4443 from nouiz/grad_abs
Change the grad of abs to prevent relu from generating nan in fast_compile
上级
46fbfeb6
3974f9b4
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
26 行增加
和
0 行删除
+26
-0
faq.txt
doc/faq.txt
+14
-0
basic.py
theano/scalar/basic.py
+2
-0
test_basic.py
theano/scalar/tests/test_basic.py
+10
-0
test_opt.py
theano/tensor/tests/test_opt.py
+0
-0
没有找到文件。
doc/faq.txt
浏览文件 @
200babca
...
...
@@ -25,6 +25,20 @@ Python requires that *__len__* returns an integer, yet it cannot be done as Thea
This error message cannot be made more explicit because the relevant aspects of Python's
internals cannot be modified.
Output slight numerical difference
----------------------------------
Sometimes when you compare the output of Theano using different
Theano flags, Theano versions, CPU and GPU or with other software like
NumPy, you will see small numerical differences.
This is normal. Floating point numbers are approximations of real
numbers. This is why doing a+(b+c) vs (a+b)+c can give small
differences of value. This is normal. For more details, see: `What
Every Computer Scientist Should Know About Floating-Point Arithmetic
<https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html>`_.
Faster gcc optimization
-----------------------
...
...
theano/scalar/basic.py
浏览文件 @
200babca
...
...
@@ -2150,6 +2150,8 @@ class Abs(UnaryScalarOp):
else
:
return
[
x
.
zeros_like
()]
if
x
.
type
in
float_types
:
return
gz
*
sgn
(
x
),
return
gz
*
x
/
abs
(
x
),
# formula works for complex and real
def
c_code
(
self
,
node
,
name
,
inputs
,
outputs
,
sub
):
...
...
theano/scalar/tests/test_basic.py
浏览文件 @
200babca
...
...
@@ -453,6 +453,16 @@ def test_grad_inrange():
utt
.
assert_allclose
(
f
(
7
,
1
,
5
),
[
0
,
0
,
0
])
def
test_grad_abs
():
a
=
theano
.
tensor
.
fscalar
(
"a"
)
b
=
theano
.
tensor
.
nnet
.
relu
(
a
)
c
=
theano
.
grad
(
b
,
a
)
f
=
theano
.
function
([
a
],
c
,
mode
=
theano
.
Mode
(
optimizer
=
None
))
# Currently Theano return 0.5, but it isn't sure it won't change
# in the futur.
ret
=
f
(
0.
)
assert
ret
==
0.5
,
ret
# Testing of Composite is done in tensor/tests/test_opt.py
# in test_fusion, TestCompositeCodegen
...
...
theano/tensor/tests/test_opt.py
浏览文件 @
200babca
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论