Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b9b10ced
提交
b9b10ced
authored
1月 08, 2016
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add optional opt that convert all *AllocEmpty to *Alloc.
上级
ef8ee794
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
46 行增加
和
0 行删除
+46
-0
opt.py
theano/sandbox/cuda/opt.py
+13
-0
opt.py
theano/sandbox/gpuarray/opt.py
+13
-0
opt.py
theano/tensor/opt.py
+20
-0
没有找到文件。
theano/sandbox/cuda/opt.py
浏览文件 @
b9b10ced
...
@@ -2540,6 +2540,19 @@ def local_gpu_allocempty(node):
...
@@ -2540,6 +2540,19 @@ def local_gpu_allocempty(node):
return
False
return
False
# Don't register by default.
@gof.local_optimizer
([
GpuAllocEmpty
])
def
local_gpu_alloc_empty_to_zeros
(
node
):
if
isinstance
(
node
.
op
,
GpuAllocEmpty
):
return
[
gpu_alloc
(
theano
.
tensor
.
constant
(
0
,
dtype
=
'float32'
),
*
node
.
inputs
)]
optdb
.
register
(
'local_gpu_alloc_empty_to_zeros'
,
local_gpu_alloc_empty_to_zeros
,
# After move to gpu and merge2, before inplace.
49.3
,
'alloc_empty_to_zeros'
,)
def
typeInfer
(
node
):
def
typeInfer
(
node
):
return
typeConstructor
return
typeConstructor
...
...
theano/sandbox/gpuarray/opt.py
浏览文件 @
b9b10ced
...
@@ -300,6 +300,19 @@ def local_gpualloc_memset_0(node):
...
@@ -300,6 +300,19 @@ def local_gpualloc_memset_0(node):
return
[
new_op
(
*
node
.
inputs
)]
return
[
new_op
(
*
node
.
inputs
)]
# Don't register by default.
@gof.local_optimizer
([
GpuAllocEmpty
])
def
local_gpua_alloc_empty_to_zeros
(
node
):
if
isinstance
(
node
.
op
,
GpuAllocEmpty
):
return
[
GpuAlloc
()(
theano
.
tensor
.
constant
(
0
,
dtype
=
'float32'
),
*
node
.
inputs
)]
optdb
.
register
(
'local_gpua_alloc_empty_to_zeros'
,
local_gpua_alloc_empty_to_zeros
,
# After move to gpu and merge2, before inplace.
49.3
,
'alloc_empty_to_zeros'
,)
@register_opt
()
@register_opt
()
@local_optimizer
([
GpuContiguous
])
@local_optimizer
([
GpuContiguous
])
def
local_gpu_contiguous_gpu_contiguous
(
node
):
def
local_gpu_contiguous_gpu_contiguous
(
node
):
...
...
theano/tensor/opt.py
浏览文件 @
b9b10ced
...
@@ -1766,6 +1766,26 @@ def local_useless_alloc(node):
...
@@ -1766,6 +1766,26 @@ def local_useless_alloc(node):
return
[
node
.
inputs
[
0
]]
return
[
node
.
inputs
[
0
]]
# Don't register by default.
@gof.local_optimizer
([
T
.
AllocEmpty
])
def
local_alloc_empty_to_zeros
(
node
):
"""This convert AllocEmpty to Alloc of 0.
This help investigate NaN with NanGuardMode. Not registered by
default. To activate it, use the Theano flag
optimizer_including=alloc_empty_to_zeros. This also enable
the GPU version of this optimizations.
"""
if
isinstance
(
node
.
op
,
T
.
AllocEmpty
):
return
[
T
.
zeros
(
node
.
inputs
,
dtype
=
node
.
outputs
[
0
]
.
dtype
)]
compile
.
optdb
.
register
(
'local_alloc_empty_to_zeros'
,
local_alloc_empty_to_zeros
,
# After move to gpu and merge2, before inplace.
49.3
,
'alloc_empty_to_zeros'
,)
@register_specialize
@register_specialize
@register_canonicalize
@register_canonicalize
@gof.local_optimizer
([
T
.
shape
])
@gof.local_optimizer
([
T
.
shape
])
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论