Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
a9454113
提交
a9454113
authored
8月 26, 2014
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
small code clean up (and remove potential bug that currently don't happen)
上级
7bab3eac
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
6 行增加
和
4 行删除
+6
-4
opt.py
theano/sandbox/cuda/opt.py
+6
-4
没有找到文件。
theano/sandbox/cuda/opt.py
浏览文件 @
a9454113
...
@@ -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
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论