提交 91f71351 authored 作者: --global's avatar --global

pep8

上级 d36faf23
...@@ -1060,8 +1060,7 @@ def test_dnn_conv_grad(): ...@@ -1060,8 +1060,7 @@ def test_dnn_conv_grad():
def get_conv3d_test_cases(): def get_conv3d_test_cases():
# Every element of test_shapes follows the format # Every element of test_shapes follows the format
# [input_shape, filter_shape, subsample] # [input_shape, filter_shape, subsample]
test_shapes = [ # Test with standard size inputs and kernels test_shapes = [[(128, 3, 5, 5, 5), (64, 3, 1, 2, 4), (1, 1, 1)],
[(128, 3, 5, 5, 5), (64, 3, 1, 2, 4), (1, 1, 1)],
[(8, 4, 20, 12, 15), (5, 4, 6, 12, 4), (2, 2, 2)], [(8, 4, 20, 12, 15), (5, 4, 6, 12, 4), (2, 2, 2)],
[(8, 1, 20, 12, 15), (5, 1, 6, 12, 4), (3, 3, 3)], [(8, 1, 20, 12, 15), (5, 1, 6, 12, 4), (3, 3, 3)],
[(8, 1, 20, 12, 15), (5, 1, 6, 12, 4), (3, 2, 1)], [(8, 1, 20, 12, 15), (5, 1, 6, 12, 4), (3, 2, 1)],
...@@ -1154,9 +1153,9 @@ def test_conv3d_fwd(): ...@@ -1154,9 +1153,9 @@ def test_conv3d_fwd():
# Compile a theano function for the reference implementation # Compile a theano function for the reference implementation
conv_ref = theano.tensor.nnet.conv3D( conv_ref = theano.tensor.nnet.conv3D(
V=padded_inputs.dimshuffle(0, 2, 3, 4, 1), V=padded_inputs.dimshuffle(0, 2, 3, 4, 1),
W=flipped_filters.dimshuffle(0, 2, 3, 4, 1), W=flipped_filters.dimshuffle(0, 2, 3, 4, 1),
b=bias, d=subsample) b=bias, d=subsample)
f_ref = theano.function([], conv_ref.dimshuffle(0, 4, 1, 2, 3)) f_ref = theano.function([], conv_ref.dimshuffle(0, 4, 1, 2, 3))
# Compare the results of the two implementations # Compare the results of the two implementations
...@@ -1222,9 +1221,9 @@ def test_conv3d_bwd(): ...@@ -1222,9 +1221,9 @@ def test_conv3d_bwd():
# Compile a theano function for the reference implementation # Compile a theano function for the reference implementation
conv_ref = theano.tensor.nnet.conv3D( conv_ref = theano.tensor.nnet.conv3D(
V=padded_inputs.dimshuffle(0, 2, 3, 4, 1), V=padded_inputs.dimshuffle(0, 2, 3, 4, 1),
W=flipped_filters.dimshuffle(0, 2, 3, 4, 1), W=flipped_filters.dimshuffle(0, 2, 3, 4, 1),
b=bias, d=subsample) b=bias, d=subsample)
(grad_padded_i_ref, (grad_padded_i_ref,
grad_w_ref) = theano.tensor.grad(conv_ref.sum(), grad_w_ref) = theano.tensor.grad(conv_ref.sum(),
[padded_inputs, filters]) [padded_inputs, filters])
...@@ -1235,10 +1234,10 @@ def test_conv3d_bwd(): ...@@ -1235,10 +1234,10 @@ def test_conv3d_bwd():
else: else:
shp = grad_padded_i_ref.shape shp = grad_padded_i_ref.shape
grad_i_ref = grad_padded_i_ref[ grad_i_ref = grad_padded_i_ref[
:, :, :, :,
pad_per_dim[0]:shp[2] - pad_per_dim[0], pad_per_dim[0]:shp[2] - pad_per_dim[0],
pad_per_dim[1]:shp[3] - pad_per_dim[1], pad_per_dim[1]:shp[3] - pad_per_dim[1],
pad_per_dim[2]:shp[4] - pad_per_dim[2]] pad_per_dim[2]:shp[4] - pad_per_dim[2]]
f_ref = theano.function([], [grad_i_ref, grad_w_ref]) f_ref = theano.function([], [grad_i_ref, grad_w_ref])
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论