Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
8320763f
提交
8320763f
authored
1月 08, 2014
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
implement GpuArrayType.values_eq_approx() parameter atol and rtol.
Make the gpuarray opt for conv use it.
上级
66b27afb
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
23 行增加
和
4 行删除
+23
-4
opt.py
theano/sandbox/gpuarray/opt.py
+2
-1
type.py
theano/sandbox/gpuarray/type.py
+21
-3
没有找到文件。
theano/sandbox/gpuarray/opt.py
浏览文件 @
8320763f
...
@@ -367,8 +367,9 @@ def local_gpu_conv(node):
...
@@ -367,8 +367,9 @@ def local_gpu_conv(node):
assert
a
.
ndim
==
4
assert
a
.
ndim
==
4
atol
=
None
atol
=
None
if
a
.
shape
[
-
1
]
*
a
.
shape
[
-
2
]
>
100
:
if
a
.
shape
[
-
1
]
*
a
.
shape
[
-
2
]
>
100
:
#For float32 the default atol is 1e-5
atol
=
3e-5
atol
=
3e-5
return
tensor
.
Tensor
Type
.
values_eq_approx
(
a
,
b
,
atol
=
atol
)
return
CudaNdarray
Type
.
values_eq_approx
(
a
,
b
,
atol
=
atol
)
if
node
.
op
==
gpu_from_host
:
if
node
.
op
==
gpu_from_host
:
#gpu_from_host(conv) -> gpu_conv(gpu_from_host)
#gpu_from_host(conv) -> gpu_conv(gpu_from_host)
...
...
theano/sandbox/gpuarray/type.py
浏览文件 @
8320763f
...
@@ -100,15 +100,33 @@ class GpuArrayType(Type):
...
@@ -100,15 +100,33 @@ class GpuArrayType(Type):
return
numpy
.
asarray
(
compare
(
a
,
'=='
,
b
))
.
all
()
return
numpy
.
asarray
(
compare
(
a
,
'=='
,
b
))
.
all
()
@staticmethod
@staticmethod
def
values_eq_approx
(
a
,
b
):
def
values_eq_approx
(
a
,
b
,
allow_remove_inf
=
False
,
allow_remove_nan
=
False
,
rtol
=
None
,
atol
=
None
):
if
a
.
shape
!=
b
.
shape
or
a
.
dtype
!=
b
.
dtype
:
if
a
.
shape
!=
b
.
shape
or
a
.
dtype
!=
b
.
dtype
:
return
False
return
False
if
'int'
in
str
(
a
.
dtype
):
if
'int'
in
str
(
a
.
dtype
):
return
GpuArrayType
.
values_eq
(
a
,
b
)
return
GpuArrayType
.
values_eq
(
a
,
b
)
else
:
else
:
if
allow_remove_inf
or
allow_remove_nan
:
raise
NotImplementedError
(
"GpuArrayType.values_eq_approx() don't implemented the"
" allow_remove_inf and allow_remove_nan parameter"
)
narrow
=
'float32'
,
'complex64'
if
(
str
(
a
.
dtype
)
in
narrow
)
or
(
str
(
b
.
dtype
)
in
narrow
):
atol_
=
theano
.
tensor
.
basic
.
float32_atol
rtol_
=
theano
.
tensor
.
basic
.
float32_rtol
else
:
atol_
=
theano
.
tensor
.
basic
.
float64_atol
rtol_
=
theano
.
tensor
.
basic
.
float64_rtol
if
rtol
is
not
None
:
rtol_
=
rtol
if
atol
is
not
None
:
atol_
=
atol
res
=
elemwise2
(
a
,
''
,
b
,
a
,
odtype
=
numpy
.
dtype
(
'bool'
),
res
=
elemwise2
(
a
,
''
,
b
,
a
,
odtype
=
numpy
.
dtype
(
'bool'
),
op_tmpl
=
"res[i] = (fabs(
%(a)
s -
%(b)
s) <"
op_tmpl
=
"res[i] = (fabs(
%%(a)
s -
%%(b)
s) <"
"(1e-8 + 1e-5 * fabs(
%(b)
s)))"
)
"(
%(atol_)
s +
%(rtol_)
s * fabs(
%%(b)
s)))"
%
locals
())
return
numpy
.
asarray
(
res
)
.
all
()
return
numpy
.
asarray
(
res
)
.
all
()
def
value_zeros
(
self
,
shape
):
def
value_zeros
(
self
,
shape
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论