Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
aef67878
提交
aef67878
authored
11月 25, 2014
作者:
Frédéric Bastien
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2297 from f0k/metaopt-again
conv2d meta-optimizer missing commits
上级
1fdf3bd3
30e8007d
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
16 行增加
和
10 行删除
+16
-10
conv.txt
doc/library/tensor/nnet/conv.txt
+10
-0
opt.py
theano/gof/opt.py
+6
-5
opt.py
theano/sandbox/cuda/opt.py
+0
-5
没有找到文件。
doc/library/tensor/nnet/conv.txt
浏览文件 @
aef67878
...
@@ -46,6 +46,16 @@
...
@@ -46,6 +46,16 @@
into Theano, and an implementation by Alex Krizhevsky available via
into Theano, and an implementation by Alex Krizhevsky available via
Pylearn2. See the documentation below on how to use them.
Pylearn2. See the documentation below on how to use them.
As of November 24th, 2014, you can also use a meta-optimizer to
automatically choose the fastest implementation for each specific
convolution in your graph. For each instance, it will compile and benchmark
each applicable implementation of the ones listed below and choose the
fastest one. As performance is dependent on input and filter shapes, this
only works for operations introduced via nnet.conv2d with fully specified
shape information.
Enable it via the Theano flag ``optimizer_including=conv_meta``, and
optionally set it to verbose mode via the flag `metaopt.verbose=1`.
TODO: Give examples on how to use these things! They are pretty complicated.
TODO: Give examples on how to use these things! They are pretty complicated.
...
...
theano/gof/opt.py
浏览文件 @
aef67878
...
@@ -823,6 +823,10 @@ class LocalOptimizer(object):
...
@@ -823,6 +823,10 @@ class LocalOptimizer(object):
(
' '
*
level
),
self
.
__class__
.
__name__
,
id
(
self
))
(
' '
*
level
),
self
.
__class__
.
__name__
,
id
(
self
))
theano
.
configparser
.
AddConfigVar
(
'metaopt.verbose'
,
"Enable verbose output for meta optimizers"
,
theano
.
configparser
.
BoolParam
(
False
),
in_c_key
=
False
)
class
LocalMetaOptimizer
(
LocalOptimizer
):
class
LocalMetaOptimizer
(
LocalOptimizer
):
"""Base class for meta-optimizers that try a set of LocalOptimizers
"""Base class for meta-optimizers that try a set of LocalOptimizers
to replace a node and choose the one that executes the fastest"""
to replace a node and choose the one that executes the fastest"""
...
@@ -830,7 +834,7 @@ class LocalMetaOptimizer(LocalOptimizer):
...
@@ -830,7 +834,7 @@ class LocalMetaOptimizer(LocalOptimizer):
def
__init__
(
self
,
tracks
=
None
,
optimizers
=
()):
def
__init__
(
self
,
tracks
=
None
,
optimizers
=
()):
self
.
_tracks
=
tracks
self
.
_tracks
=
tracks
self
.
optimizers
=
list
(
optimizers
)
self
.
optimizers
=
list
(
optimizers
)
self
.
verbose
=
Fal
se
self
.
verbose
=
config
.
metaopt
.
verbo
se
def
register
(
self
,
optimizer
):
def
register
(
self
,
optimizer
):
self
.
optimizers
.
append
(
optimizer
)
self
.
optimizers
.
append
(
optimizer
)
...
@@ -876,10 +880,7 @@ class LocalMetaOptimizer(LocalOptimizer):
...
@@ -876,10 +880,7 @@ class LocalMetaOptimizer(LocalOptimizer):
outputs
=
opt
.
transform
(
node
)
outputs
=
opt
.
transform
(
node
)
if
outputs
:
if
outputs
:
try
:
try
:
fn
=
theano
.
function
([],
fn
=
theano
.
function
([],
outputs
,
givens
=
givens
)
[
theano
.
Out
(
output
,
borrow
=
True
)
for
output
in
outputs
],
givens
=
givens
)
timing
=
min
(
self
.
time_call
(
fn
)
for
_
in
range
(
3
))
timing
=
min
(
self
.
time_call
(
fn
)
for
_
in
range
(
3
))
except
Exception
as
e
:
except
Exception
as
e
:
if
self
.
verbose
:
if
self
.
verbose
:
...
...
theano/sandbox/cuda/opt.py
浏览文件 @
aef67878
...
@@ -1361,14 +1361,9 @@ class LocalCudaMetaOptimizer(LocalMetaOptimizer):
...
@@ -1361,14 +1361,9 @@ class LocalCudaMetaOptimizer(LocalMetaOptimizer):
# Convolution Meta-optimizer
# Convolution Meta-optimizer
theano
.
configparser
.
AddConfigVar
(
'conv_meta.verbose'
,
"Enable verbose output for conv_meta optimizer"
,
theano
.
configparser
.
BoolParam
(
False
),
in_c_key
=
False
)
class
ConvMetaOptimizer
(
LocalCudaMetaOptimizer
):
class
ConvMetaOptimizer
(
LocalCudaMetaOptimizer
):
def
__init__
(
self
,
optimizers
):
def
__init__
(
self
,
optimizers
):
super
(
ConvMetaOptimizer
,
self
)
.
__init__
([
GpuConv
],
optimizers
)
super
(
ConvMetaOptimizer
,
self
)
.
__init__
([
GpuConv
],
optimizers
)
self
.
verbose
=
config
.
conv_meta
.
verbose
def
provide_inputs
(
self
,
node
,
inputs
):
def
provide_inputs
(
self
,
node
,
inputs
):
# We need to provide dummy data for the given inputs.
# We need to provide dummy data for the given inputs.
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论