Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
06bc1277
提交
06bc1277
authored
10月 21, 2015
作者:
Nicolas Ballas
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update abstract conv2d to be consistent with nnet.conv2d and add fast compile flag to the cpu opt
上级
0e85602f
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
17 行增加
和
17 行删除
+17
-17
test_abstractconv.py
theano/sandbox/cuda/tests/test_abstractconv.py
+3
-3
abstract_conv2d.py
theano/tensor/nnet/abstract_conv2d.py
+14
-14
没有找到文件。
theano/sandbox/cuda/tests/test_abstractconv.py
浏览文件 @
06bc1277
...
...
@@ -80,9 +80,9 @@ class TestConv2d(unittest.TestCase):
c
=
conv
.
conv2d
(
inputs
,
filters
,
border_mode
=
border_mode
,
subsample
=
subsample
,
filter
s
_flip
=
filters_flip
,
input
s
_shape
=
imshp
,
filter
s
_shape
=
kshp
)
filter_flip
=
filters_flip
,
input_shape
=
imshp
,
filter_shape
=
kshp
)
f_ref
=
theano
.
function
([],
c_ref
,
mode
=
mode
)
f
=
theano
.
function
([],
c
,
mode
)
res_ref
=
numpy
.
array
(
f_ref
())
...
...
theano/tensor/nnet/abstract_conv2d.py
浏览文件 @
06bc1277
...
...
@@ -22,19 +22,19 @@ from theano.tensor.nnet.ConvTransp3D import convTransp3D
_logger
=
logging
.
getLogger
(
"theano.tensor.nnet.conv2d"
)
def
conv2d
(
input
s
,
def
conv2d
(
input
,
filters
,
input
s
_shape
=
None
,
filter
s
_shape
=
None
,
input_shape
=
None
,
filter_shape
=
None
,
border_mode
=
'valid'
,
subsample
=
(
1
,
1
),
filter
s
_flip
=
True
):
filter_flip
=
True
):
"""
This function will build the symbolic graph for convolving a mini-batch of a
stack of 2D inputs with a set of 2D filters. The implementation is modelled
after Convolutional Neural Networks (CNN).
:type input
s
: symbolic 4D tensor
:type input: symbolic 4D tensor
:param input: mini-batch of feature map stacks, of shape
(batch size, input channels, input rows, input columns).
See the optional parameter ``input_shape``.
...
...
@@ -44,13 +44,13 @@ def conv2d(inputs,
(output channels, input channels, filter rows, filter columns).
See the optional parameter ``filter_shape``.
:type input
s
_shape: None, tuple/list of len 4 of int or Constant variable
:type input_shape: None, tuple/list of len 4 of int or Constant variable
:param input_shape: The shape of the input parameter.
Optional, possibly used to choose an optimal implementation.
You can give ``None`` for any element of the list to specify that this
element is not known at compile time.
:type filter
s
_shape: None, tuple/list of len 4 of int or Constant variable
:type filter_shape: None, tuple/list of len 4 of int or Constant variable
:param filter_shape: The shape of the filters parameter.
Optional, possibly used to choose an optimal implementation.
You can give ``None`` for any element of the list to specify that this
...
...
@@ -75,7 +75,7 @@ def conv2d(inputs,
:param subsample: factor by which to subsample the output.
Also called strides elsewhere.
:type filter
s
_flip: bool
:type filter_flip: bool
:param filters_flip: If ``True``, will flip the filter rows and columns
before sliding them over the input. This operation is normally referred
to as a convolution, and this is the default. If ``False``, the filters
...
...
@@ -86,12 +86,12 @@ def conv2d(inputs,
of shape (batch size, output channels, output rows, output columns)
"""
conv_op
=
AbstractConv2d
(
imshp
=
input
s
_shape
,
kshp
=
filter
s
_shape
,
conv_op
=
AbstractConv2d
(
imshp
=
input_shape
,
kshp
=
filter_shape
,
border_mode
=
border_mode
,
subsample
=
subsample
,
filter
s_flip
=
filters
_flip
)
return
conv_op
(
input
s
,
filters
)
filter
_flip
=
filter
_flip
)
return
conv_op
(
input
,
filters
)
class
BaseAbstractConv2d
(
Op
):
...
...
@@ -352,7 +352,7 @@ def local_conv2d_cpu(node):
border_mode
=
node
.
op
.
border_mode
,
subsample
=
node
.
op
.
subsample
)
return
[
rval
]
register_specialize_device
(
local_conv2d_cpu
)
register_specialize_device
(
local_conv2d_cpu
,
'fast_compile'
)
@local_optimizer
([
AbstractConv2d_gradWeights
])
...
...
@@ -462,7 +462,7 @@ def local_conv2d_gradweight_cpu(node):
res
=
patternbroadcast
(
res
,
node
.
outputs
[
0
]
.
broadcastable
)
return
[
res
]
register_specialize_device
(
local_conv2d_gradweight_cpu
)
register_specialize_device
(
local_conv2d_gradweight_cpu
,
'fast_compile'
)
@local_optimizer
([
AbstractConv2d_gradInputs
])
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论