提交 0abf03bd authored 作者: Matthias Kümmerer's avatar Matthias Kümmerer

Test for R_op of AbstractConv2d

上级 578c145b
...@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论