Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
d15656b7
提交
d15656b7
authored
7月 28, 2015
作者:
Nicolas Ballas
提交者:
Pascal Lamblin
10月 14, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
77ecf5c6
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
24 行增加
和
20 行删除
+24
-20
abstract_conv2d.py
theano/tensor/nnet/abstract_conv2d.py
+5
-5
test_abstractconv.py
theano/tensor/nnet/tests/test_abstractconv.py
+19
-15
没有找到文件。
theano/tensor/nnet/abstract_conv2d.py
浏览文件 @
d15656b7
...
@@ -275,11 +275,11 @@ class AbstractConv2d_gradWeights(BaseAbstractConv2d):
...
@@ -275,11 +275,11 @@ class AbstractConv2d_gradWeights(BaseAbstractConv2d):
self
.
border_mode
,
self
.
border_mode
,
self
.
subsample
,
self
.
subsample
,
self
.
filter_flip
)(
bottom
,
weights
)
self
.
filter_flip
)(
bottom
,
weights
)
d_height_width
=
(
theano
.
gradient
.
DisconnectedType
()(),)
*
2
d_height_width
=
(
theano
.
gradient
.
DisconnectedType
()(),)
return
(
d_bottom
,
d_top
)
+
d_height_width
return
(
d_bottom
,
d_top
)
+
d_height_width
def
connection_pattern
(
self
,
node
):
def
connection_pattern
(
self
,
node
):
return
[[
1
],
[
1
],
[
0
]
,
[
0
]
]
# no connection to height, width
return
[[
1
],
[
1
],
[
0
]]
# no connection to height, width
class
AbstractConv2d_gradInputs
(
BaseAbstractConv2d
):
class
AbstractConv2d_gradInputs
(
BaseAbstractConv2d
):
...
@@ -331,13 +331,13 @@ class AbstractConv2d_gradInputs(BaseAbstractConv2d):
...
@@ -331,13 +331,13 @@ class AbstractConv2d_gradInputs(BaseAbstractConv2d):
self
.
bsize
,
self
.
bsize
,
self
.
border_mode
,
self
.
border_mode
,
self
.
subsample
)(
bottom
,
top
,
weights
.
shape
[
-
2
:])
self
.
subsample
)(
bottom
,
top
,
weights
.
shape
[
-
2
:])
d_top
=
AbstractConv2d
(
self
.
imshp
,
self
.
filter_shape
,
self
.
bsize
,
d_top
=
AbstractConv2d
(
self
.
imshp
,
self
.
kshp
,
self
.
bsize
,
self
.
border_mode
,
self
.
subsample
)(
bottom
,
weights
)
self
.
border_mode
,
self
.
subsample
)(
bottom
,
weights
)
d_height_width
=
(
theano
.
gradient
.
DisconnectedType
()(),)
*
2
d_height_width
=
(
theano
.
gradient
.
DisconnectedType
()(),)
return
(
d_weights
,
d_top
)
+
d_height_width
return
(
d_weights
,
d_top
)
+
d_height_width
def
connection_pattern
(
self
,
node
):
def
connection_pattern
(
self
,
node
):
return
[[
1
],
[
1
],
[
0
]
,
[
0
]
]
# no connection to height, width
return
[[
1
],
[
1
],
[
0
]]
# no connection to height, width
### Optimizations should be move in their appropriate files
### Optimizations should be move in their appropriate files
...
...
theano/tensor/nnet/tests/test_abstractconv.py
浏览文件 @
d15656b7
...
@@ -114,10 +114,14 @@ class TestConv2d(unittest.TestCase):
...
@@ -114,10 +114,14 @@ class TestConv2d(unittest.TestCase):
print
res_ref
.
shape
,
res
.
shape
print
res_ref
.
shape
,
res
.
shape
utt
.
assert_allclose
(
res_ref
,
res
)
utt
.
assert_allclose
(
res_ref
,
res
)
def
abstract_conv2d_gradweight
(
inputs_val
,
output_val
):
conv_op
=
conv
.
AbstractConv2d_gradInputs
(
border_mode
=
border_mode
,
subsample
=
subsample
)
return
conv_op
(
inputs_val
,
output_val
,
filters_shape
[
-
2
:])
if
verify_grad
:
if
verify_grad
:
utt
.
verify_grad
(
conv
.
AbstractConv2d
(
border_mode
=
"valid"
,
utt
.
verify_grad
(
abstract_conv2d_gradweight
,
subsample
=
subsample
),
[
inputs_val
,
output_val
])
[
inputs_val
,
filters_val
])
def
run_gradinput
(
self
,
def
run_gradinput
(
self
,
...
@@ -173,18 +177,18 @@ class TestConv2d(unittest.TestCase):
...
@@ -173,18 +177,18 @@ class TestConv2d(unittest.TestCase):
#
def test_corrmm(self):
def
test_corrmm
(
self
):
#
mode = mode_with_gpu
mode
=
mode_with_gpu
#
mode = mode.excluding('cudnn')
mode
=
mode
.
excluding
(
'cudnn'
)
#
self.run_fwd(inputs_shape=(16, 1, 2, 2),
self
.
run_fwd
(
inputs_shape
=
(
16
,
1
,
2
,
2
),
#
filters_shape=(10, 1, 2, 2),
filters_shape
=
(
10
,
1
,
2
,
2
),
#
verify_grad=False, mode=mode)
verify_grad
=
False
,
mode
=
mode
)
#
self.run_gradweight(inputs_shape=(16, 1, 2, 2),
self
.
run_gradweight
(
inputs_shape
=
(
16
,
1
,
2
,
2
),
#
filters_shape=(10, 1, 2, 2),
filters_shape
=
(
10
,
1
,
2
,
2
),
#
verify_grad=False, mode=mode)
verify_grad
=
False
,
mode
=
mode
)
#
self.run_gradinput(inputs_shape=(1, 1, 2, 2),
self
.
run_gradinput
(
inputs_shape
=
(
1
,
1
,
2
,
2
),
#
filters_shape=(10, 1, 2, 2),
filters_shape
=
(
10
,
1
,
2
,
2
),
#
verify_grad=False, mode=mode)
verify_grad
=
False
,
mode
=
mode
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论