Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
33c507f0
提交
33c507f0
authored
11月 24, 2014
作者:
abergeron
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2280 from nouiz/import_fix
Fix recursive import. Do not make dnn import opt. opt stil import dnn
上级
b6a15d9d
03071a68
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
25 行增加
和
24 行删除
+25
-24
__init__.py
theano/sandbox/cuda/__init__.py
+18
-0
dnn.py
theano/sandbox/cuda/dnn.py
+4
-8
extra_ops.py
theano/sandbox/cuda/extra_ops.py
+1
-2
opt.py
theano/sandbox/cuda/opt.py
+2
-14
没有找到文件。
theano/sandbox/cuda/__init__.py
浏览文件 @
33c507f0
...
@@ -9,11 +9,29 @@ import sys
...
@@ -9,11 +9,29 @@ import sys
import
theano
import
theano
from
theano.compat
import
get_unbound_function
from
theano.compat
import
get_unbound_function
from
theano.compile
import
optdb
from
theano.compile
import
optdb
from
theano.gof
import
EquilibriumDB
,
SequenceDB
from
theano.gof.cmodule
import
get_lib_extension
from
theano.gof.cmodule
import
get_lib_extension
from
theano.gof.compilelock
import
get_lock
,
release_lock
from
theano.gof.compilelock
import
get_lock
,
release_lock
from
theano.configparser
import
config
,
AddConfigVar
,
StrParam
,
BoolParam
from
theano.configparser
import
config
,
AddConfigVar
,
StrParam
,
BoolParam
import
nvcc_compiler
import
nvcc_compiler
# ignore_newtrees is to speed the optimization as this is the pattern
# we use for optimization. Otherwise, we can iterate 100s of time on
# the graph and apply only a few optimizations each time.
gpu_optimizer
=
EquilibriumDB
(
ignore_newtrees
=
False
)
gpu_seqopt
=
SequenceDB
()
def
register_opt
(
*
tags
,
**
kwargs
):
def
f
(
local_opt
):
name
=
(
kwargs
and
kwargs
.
pop
(
'name'
))
or
local_opt
.
__name__
gpu_optimizer
.
register
(
name
,
local_opt
,
'fast_run'
,
'fast_compile'
,
'gpu'
,
*
tags
)
return
local_opt
return
f
_logger_name
=
'theano.sandbox.cuda'
_logger_name
=
'theano.sandbox.cuda'
_logger
=
logging
.
getLogger
(
_logger_name
)
_logger
=
logging
.
getLogger
(
_logger_name
)
...
...
theano/sandbox/cuda/dnn.py
浏览文件 @
33c507f0
...
@@ -2,7 +2,7 @@ import os
...
@@ -2,7 +2,7 @@ import os
import
theano
import
theano
from
theano
import
Apply
,
gof
,
tensor
from
theano
import
Apply
,
gof
,
tensor
from
theano.gof
import
Optimizer
from
theano.gof
import
Optimizer
,
local_optimizer
from
theano.gof.type
import
CDataType
from
theano.gof.type
import
CDataType
from
theano.compat
import
PY3
from
theano.compat
import
PY3
from
theano.tensor.nnet
import
SoftmaxGrad
from
theano.tensor.nnet
import
SoftmaxGrad
...
@@ -13,7 +13,7 @@ from theano.sandbox.cuda.basic_ops import (as_cuda_ndarray_variable,
...
@@ -13,7 +13,7 @@ from theano.sandbox.cuda.basic_ops import (as_cuda_ndarray_variable,
from
theano.sandbox.cuda.blas
import
(
GpuConv
,
GpuDownsampleFactorMax
,
from
theano.sandbox.cuda.blas
import
(
GpuConv
,
GpuDownsampleFactorMax
,
GpuDownsampleFactorMaxGrad
)
GpuDownsampleFactorMaxGrad
)
from
theano.sandbox.cuda.nnet
import
GpuSoftmax
from
theano.sandbox.cuda.nnet
import
GpuSoftmax
from
theano.sandbox.cuda
.opt
import
register_opt
from
theano.sandbox.cuda
import
gpu_seqopt
,
register_opt
from
theano.sandbox.cuda.nvcc_compiler
import
NVCC_compiler
from
theano.sandbox.cuda.nvcc_compiler
import
NVCC_compiler
...
@@ -1145,12 +1145,8 @@ err%(name)s = cudnnSoftmaxBackward(
...
@@ -1145,12 +1145,8 @@ err%(name)s = cudnnSoftmaxBackward(
"""
"""
# We need this since other stuff from opt is not importable.
# Intentation for history
if
cuda_available
:
if
True
:
from
theano.sandbox.cuda.opt
import
(
local_optimizer
,
gpu_optimizer
,
gpu_seqopt
)
#@register_opt('cudnn') # this optimizer is registered in opt.py instead.
#@register_opt('cudnn') # this optimizer is registered in opt.py instead.
@local_optimizer
([
GpuConv
])
@local_optimizer
([
GpuConv
])
def
local_conv_dnn
(
node
):
def
local_conv_dnn
(
node
):
...
...
theano/sandbox/cuda/extra_ops.py
浏览文件 @
33c507f0
...
@@ -3,9 +3,8 @@ import copy
...
@@ -3,9 +3,8 @@ import copy
from
theano
import
Op
from
theano
import
Op
from
theano.gof
import
local_optimizer
from
theano.gof
import
local_optimizer
from
theano.sandbox.cuda
import
cuda_available
,
GpuOp
from
theano.sandbox.cuda
import
cuda_available
,
GpuOp
from
theano.sandbox.cuda.basic_ops
import
GpuFlatten
from
theano.tensor.extra_ops
import
CumsumOp
from
theano.tensor.extra_ops
import
CumsumOp
from
theano.sandbox.cuda
import
GpuFlatten
if
cuda_available
:
if
cuda_available
:
from
theano.sandbox.cuda
import
CudaNdarrayType
from
theano.sandbox.cuda
import
CudaNdarrayType
...
...
theano/sandbox/cuda/opt.py
浏览文件 @
33c507f0
...
@@ -13,7 +13,7 @@ from theano import config, tensor, gof
...
@@ -13,7 +13,7 @@ from theano import config, tensor, gof
import
theano.ifelse
import
theano.ifelse
from
theano.compile
import
optdb
from
theano.compile
import
optdb
from
theano.gof
import
(
local_optimizer
,
EquilibriumDB
,
SequenceDB
,
ProxyDB
,
from
theano.gof
import
(
local_optimizer
,
EquilibriumDB
,
ProxyDB
,
Optimizer
,
toolbox
)
Optimizer
,
toolbox
)
from
theano.gof.python25
import
all
,
any
from
theano.gof.python25
import
all
,
any
from
theano.sandbox.cuda.basic_ops
import
(
from
theano.sandbox.cuda.basic_ops
import
(
...
@@ -42,6 +42,7 @@ from theano.sandbox.cuda.elemwise import SupportCodeError
...
@@ -42,6 +42,7 @@ from theano.sandbox.cuda.elemwise import SupportCodeError
from
theano.scalar.basic_scipy
import
Erfinv
from
theano.scalar.basic_scipy
import
Erfinv
from
theano.sandbox.cuda.elemwise
import
erfinv_gpu
from
theano.sandbox.cuda.elemwise
import
erfinv_gpu
from
theano.sandbox.cuda.var
import
CudaNdarrayConstant
from
theano.sandbox.cuda.var
import
CudaNdarrayConstant
from
theano.sandbox.cuda
import
gpu_optimizer
,
register_opt
,
gpu_seqopt
from
theano.scan_module
import
scan_utils
,
scan_op
,
scan_opt
from
theano.scan_module
import
scan_utils
,
scan_op
,
scan_opt
from
theano.tensor.blas
import
_is_real_vector
,
_is_real_matrix
from
theano.tensor.blas
import
_is_real_vector
,
_is_real_matrix
from
theano.tensor
import
nlinalg
from
theano.tensor
import
nlinalg
...
@@ -56,12 +57,7 @@ except ImportError:
...
@@ -56,12 +57,7 @@ except ImportError:
#optdb.print_summary() # shows what is currently registered
#optdb.print_summary() # shows what is currently registered
#ignore_newtrees is to speed the optimization as this is the pattern
#we use for optimization. Otherwise, we can iterate 100s of time on
#the graph and apply only a few optimizations each time.
gpu_optimizer
=
EquilibriumDB
(
ignore_newtrees
=
False
)
gpu_cut_copies
=
EquilibriumDB
()
gpu_cut_copies
=
EquilibriumDB
()
gpu_seqopt
=
SequenceDB
()
gpu_seqopt
.
register
(
'gpu_local_optimizations'
,
gpu_optimizer
,
1
,
gpu_seqopt
.
register
(
'gpu_local_optimizations'
,
gpu_optimizer
,
1
,
'fast_run'
,
'fast_compile'
,
'inplace'
,
'gpu'
)
'fast_run'
,
'fast_compile'
,
'inplace'
,
'gpu'
)
gpu_seqopt
.
register
(
'gpu_cut_transfers'
,
gpu_cut_copies
,
2
,
gpu_seqopt
.
register
(
'gpu_cut_transfers'
,
gpu_cut_copies
,
2
,
...
@@ -84,14 +80,6 @@ gpu_optimizer.register('gpu_merge', theano.gof.opt.merge_optimizer,
...
@@ -84,14 +80,6 @@ gpu_optimizer.register('gpu_merge', theano.gof.opt.merge_optimizer,
'fast_run'
,
'fast_compile'
)
'fast_run'
,
'fast_compile'
)
def
register_opt
(
*
tags
,
**
kwargs
):
def
f
(
local_opt
):
name
=
(
kwargs
and
kwargs
.
pop
(
'name'
))
or
local_opt
.
__name__
gpu_optimizer
.
register
(
name
,
local_opt
,
'fast_run'
,
'fast_compile'
,
'gpu'
,
*
tags
)
return
local_opt
return
f
#register local_track_shape_i at this level too
#register local_track_shape_i at this level too
#to make multi-level lift of shape work.
#to make multi-level lift of shape work.
register_opt
()(
theano
.
tensor
.
opt
.
local_track_shape_i
)
register_opt
()(
theano
.
tensor
.
opt
.
local_track_shape_i
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论