Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
165cbf6c
提交
165cbf6c
authored
8月 26, 2014
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2054 from nouiz/mixed
[ENH] OpenMPOp, doc and cleanup
上级
af6bd549
a9d053ec
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
18 行增加
和
8 行删除
+18
-8
conv.txt
doc/library/tensor/nnet/conv.txt
+3
-2
op.py
theano/gof/op.py
+9
-2
opt.py
theano/sandbox/cuda/opt.py
+6
-4
没有找到文件。
doc/library/tensor/nnet/conv.txt
浏览文件 @
165cbf6c
...
@@ -54,8 +54,9 @@ TODO: Give examples for how to use these things! They are pretty complicated.
...
@@ -54,8 +54,9 @@ TODO: Give examples for how to use these things! They are pretty complicated.
not be call directly as it does not implement a grad function.
not be call directly as it does not implement a grad function.
You can enable it by setting THEANO_FLAGS to
You can enable it by setting THEANO_FLAGS to
'optimizer_including=conv3d_fft:convgrad3d_fft:convtransp3d_fft'
'optimizer_including=conv3d_fft:convgrad3d_fft:convtransp3d_fft'
This is not enabled by default because it has some restrictions on
It does not support strides.
input and uses more memory. Also note that it requires CUDA >= 5.0,
This is not enabled by default because it uses more memory.
Also note that it requires CUDA >= 5.0,
scikits.cuda >= 0.5.0 and PyCUDA to run.
scikits.cuda >= 0.5.0 and PyCUDA to run.
To enable for just one Theano function:
To enable for just one Theano function:
...
...
theano/gof/op.py
浏览文件 @
165cbf6c
...
@@ -817,6 +817,12 @@ class OpenMPOp(Op):
...
@@ -817,6 +817,12 @@ class OpenMPOp(Op):
return
[
'-fopenmp'
]
return
[
'-fopenmp'
]
return
[]
return
[]
def
c_headers
(
self
):
self
.
update_self_openmp
()
if
self
.
openmp
:
return
[
"omp.h"
]
return
[]
@staticmethod
@staticmethod
def
test_gxx_support
():
def
test_gxx_support
():
code
=
"""
code
=
"""
...
@@ -845,11 +851,12 @@ int main( int argc, const char* argv[] )
...
@@ -845,11 +851,12 @@ int main( int argc, const char* argv[] )
if
OpenMPOp
.
gxx_support_openmp
is
None
:
if
OpenMPOp
.
gxx_support_openmp
is
None
:
OpenMPOp
.
gxx_support_openmp
=
OpenMPOp
.
test_gxx_support
()
OpenMPOp
.
gxx_support_openmp
=
OpenMPOp
.
test_gxx_support
()
if
not
OpenMPOp
.
gxx_support_openmp
:
if
not
OpenMPOp
.
gxx_support_openmp
:
#We want to warn only once.
#
We want to warn only once.
warnings
.
warn
(
warnings
.
warn
(
"Your g++ compiler fails to compile OpenMP code. We"
"Your g++ compiler fails to compile OpenMP code. We"
" know this happen with some version of the EPD mingw"
" know this happen with some version of the EPD mingw"
" compiler. We disable openmp everywhere in Theano."
" compiler and LLVM compiler on Mac OS X."
" We disable openmp everywhere in Theano."
" To remove this warning set the theano flags `openmp`"
" To remove this warning set the theano flags `openmp`"
" to False."
,
" to False."
,
stacklevel
=
3
)
stacklevel
=
3
)
...
...
theano/sandbox/cuda/opt.py
浏览文件 @
165cbf6c
...
@@ -43,6 +43,7 @@ from theano.sandbox.cuda.var import CudaNdarrayConstant
...
@@ -43,6 +43,7 @@ from theano.sandbox.cuda.var import CudaNdarrayConstant
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
from
theano.tensor.nnet.Conv3D
import
Conv3D
#optdb.print_summary() # shows what is currently registered
#optdb.print_summary() # shows what is currently registered
...
@@ -1236,17 +1237,18 @@ def local_conv_fft_full(node):
...
@@ -1236,17 +1237,18 @@ def local_conv_fft_full(node):
gpu_optimizer
.
register
(
"conv_fft_valid"
,
local_conv_fft_valid
)
gpu_optimizer
.
register
(
"conv_fft_valid"
,
local_conv_fft_valid
)
gpu_optimizer
.
register
(
"conv_fft_full"
,
local_conv_fft_full
)
gpu_optimizer
.
register
(
"conv_fft_full"
,
local_conv_fft_full
)
from
theano.tensor.nnet.Conv3D
import
Conv3D
@local_optimizer
([
Conv3D
])
@local_optimizer
([
Conv3D
])
def
local_conv3d_fft
(
node
):
def
local_conv3d_fft
(
node
):
if
not
isinstance
(
node
.
op
,
Conv3D
):
return
try
:
try
:
stride_x
=
tensor
.
get_scalar_constant_value
(
node
.
inputs
[
3
][
0
])
stride_x
=
tensor
.
get_scalar_constant_value
(
node
.
inputs
[
3
][
0
])
stride_y
=
tensor
.
get_scalar_constant_value
(
node
.
inputs
[
3
][
1
])
stride_y
=
tensor
.
get_scalar_constant_value
(
node
.
inputs
[
3
][
1
])
stride_z
=
tensor
.
get_scalar_constant_value
(
node
.
inputs
[
3
][
2
])
stride_z
=
tensor
.
get_scalar_constant_value
(
node
.
inputs
[
3
][
2
])
except
tensor
.
NotScalarConstantError
:
except
tensor
.
NotScalarConstantError
:
return
False
return
False
if
(
isinstance
(
node
.
op
,
Conv3D
)
and
if
(
stride_x
,
stride_y
,
stride_z
)
==
(
1
,
1
,
1
):
(
stride_x
,
stride_y
,
stride_z
)
==
(
1
,
1
,
1
)):
# we import conv3d_fft locally to avoid pycuda warnings
# we import conv3d_fft locally to avoid pycuda warnings
from
theano.sandbox.cuda.fftconv
import
conv3d_fft
from
theano.sandbox.cuda.fftconv
import
conv3d_fft
# Shuffle inputs signal from (b, 0, 1, t, c) to (b, c, 0, 1, t)
# Shuffle inputs signal from (b, 0, 1, t, c) to (b, c, 0, 1, t)
...
@@ -1256,7 +1258,7 @@ def local_conv3d_fft(node):
...
@@ -1256,7 +1258,7 @@ def local_conv3d_fft(node):
f
=
node
.
inputs
[
1
]
f
=
node
.
inputs
[
1
]
f
=
gpu_from_host
(
f
.
dimshuffle
(
0
,
4
,
1
,
2
,
3
))
f
=
gpu_from_host
(
f
.
dimshuffle
(
0
,
4
,
1
,
2
,
3
))
# filter flip
# filter flip
f
=
f
[:,
:,::
-
1
,::
-
1
,
::
-
1
]
f
=
f
[:,
:,
::
-
1
,
::
-
1
,
::
-
1
]
rval
=
conv3d_fft
(
x
,
f
,
border_mode
=
'valid'
,
pad_last_dim
=
True
)
rval
=
conv3d_fft
(
x
,
f
,
border_mode
=
'valid'
,
pad_last_dim
=
True
)
# Shuffle from (oc, c, 0, 1, t) to (oc, 0, 1, t, c)
# Shuffle from (oc, c, 0, 1, t) to (oc, 0, 1, t, c)
return
[
rval
.
dimshuffle
(
0
,
2
,
3
,
4
,
1
)
+
node
.
inputs
[
2
]]
return
[
rval
.
dimshuffle
(
0
,
2
,
3
,
4
,
1
)
+
node
.
inputs
[
2
]]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论