Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
2dc471fc
提交
2dc471fc
authored
1月 22, 2016
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3903 from matthias-k/AbstractConv2d_R_op
R_op for AbstractConv2d
上级
887e39c5
0abf03bd
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
14 行增加
和
2 行删除
+14
-2
abstract_conv.py
theano/tensor/nnet/abstract_conv.py
+11
-0
test_rop.py
theano/tests/test_rop.py
+3
-2
没有找到文件。
theano/tensor/nnet/abstract_conv.py
浏览文件 @
2dc471fc
...
@@ -308,6 +308,17 @@ class AbstractConv2d(BaseAbstractConv2d):
...
@@ -308,6 +308,17 @@ class AbstractConv2d(BaseAbstractConv2d):
'Did you exclude both "conv_dnn" and "conv_gemm" from '
'Did you exclude both "conv_dnn" and "conv_gemm" from '
'the optimizer? Is cudnn available and does the GPU support it?'
)
'the optimizer? Is cudnn available and does the GPU support it?'
)
def
R_op
(
self
,
inputs
,
eval_points
):
rval
=
None
if
eval_points
[
0
]
is
not
None
:
rval
=
self
.
make_node
(
eval_points
[
0
],
inputs
[
1
])
.
outputs
[
0
]
if
eval_points
[
1
]
is
not
None
:
if
rval
is
None
:
rval
=
self
.
make_node
(
inputs
[
0
],
eval_points
[
1
])
.
outputs
[
0
]
else
:
rval
+=
self
.
make_node
(
inputs
[
0
],
eval_points
[
1
])
.
outputs
[
0
]
return
[
rval
]
def
grad
(
self
,
inp
,
grads
):
def
grad
(
self
,
inp
,
grads
):
bottom
,
weights
=
inp
bottom
,
weights
=
inp
top
,
=
grads
top
,
=
grads
...
...
theano/tests/test_rop.py
浏览文件 @
2dc471fc
...
@@ -22,7 +22,7 @@ from theano.gof import Op, Apply
...
@@ -22,7 +22,7 @@ from theano.gof import Op, Apply
from
theano.gradient
import
grad_undefined
from
theano.gradient
import
grad_undefined
from
theano.tests.unittest_tools
import
SkipTest
from
theano.tests.unittest_tools
import
SkipTest
from
theano.tensor.signal.pool
import
Pool
from
theano.tensor.signal.pool
import
Pool
from
theano.tensor.nnet
import
conv
from
theano.tensor.nnet
import
conv
,
conv2d
'''
'''
Special Op created to test what happens when you have one op that is not
Special Op created to test what happens when you have one op that is not
...
@@ -260,6 +260,7 @@ class test_RopLop(RopLop_checker):
...
@@ -260,6 +260,7 @@ class test_RopLop(RopLop_checker):
(
1
,))
(
1
,))
def
test_conv
(
self
):
def
test_conv
(
self
):
for
conv_op
in
[
conv
.
conv2d
,
conv2d
]:
for
border_mode
in
[
'valid'
,
'full'
]:
for
border_mode
in
[
'valid'
,
'full'
]:
image_shape
=
(
2
,
2
,
4
,
5
)
image_shape
=
(
2
,
2
,
4
,
5
)
filter_shape
=
(
2
,
2
,
2
,
3
)
filter_shape
=
(
2
,
2
,
2
,
3
)
...
@@ -279,7 +280,7 @@ class test_RopLop(RopLop_checker):
...
@@ -279,7 +280,7 @@ class test_RopLop(RopLop_checker):
[
False
]
*
filter_dim
)(
name
=
'ev_filters'
)
[
False
]
*
filter_dim
)(
name
=
'ev_filters'
)
def
sym_conv2d
(
input
,
filters
):
def
sym_conv2d
(
input
,
filters
):
return
conv
.
conv2d
(
input
,
filters
,
border_mode
=
border_mode
)
return
conv_op
(
input
,
filters
,
border_mode
=
border_mode
)
output
=
sym_conv2d
(
input
,
filters
)
.
flatten
()
output
=
sym_conv2d
(
input
,
filters
)
.
flatten
()
yv
=
tensor
.
Rop
(
output
,
[
input
,
filters
],
[
ev_input
,
ev_filters
])
yv
=
tensor
.
Rop
(
output
,
[
input
,
filters
],
[
ev_input
,
ev_filters
])
rop_f
=
function
([
input
,
filters
,
ev_input
,
ev_filters
],
rop_f
=
function
([
input
,
filters
,
ev_input
,
ev_filters
],
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论