提交 ca56cb80 authored 作者: Chiheb Trabelsi's avatar Chiheb Trabelsi

test_tensor_op.py has been modified in order to respect the flake8 style.

上级 fc03bdbd
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
This file test tensor op that should also operate on CudaNdaray. This file test tensor op that should also operate on CudaNdaray.
""" """
from __future__ import absolute_import, print_function, division from __future__ import absolute_import, print_function, division
import copy
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
import numpy import numpy
...@@ -14,7 +13,7 @@ import theano.tensor as T ...@@ -14,7 +13,7 @@ import theano.tensor as T
# Skip test if cuda_ndarray is not available. # Skip test if cuda_ndarray is not available.
import theano.sandbox.cuda as cuda import theano.sandbox.cuda as cuda
from theano.tensor.nnet.tests import test_conv3d2d from theano.tensor.nnet.tests import test_conv3d2d
if cuda.cuda_available == False: if cuda.cuda_available is False:
raise SkipTest('Optional package cuda disabled') raise SkipTest('Optional package cuda disabled')
...@@ -57,7 +56,7 @@ def test_softmax_optimizations(): ...@@ -57,7 +56,7 @@ def test_softmax_optimizations():
one_of_n = tensor.lvector('one_of_n') one_of_n = tensor.lvector('one_of_n')
op = crossentropy_categorical_1hot op = crossentropy_categorical_1hot
xe = op(x, one_of_n) op(x, one_of_n)
fgraph = theano.gof.FunctionGraph( fgraph = theano.gof.FunctionGraph(
[x, one_of_n], [x, one_of_n],
...@@ -84,10 +83,10 @@ def test_may_share_memory_cuda(): ...@@ -84,10 +83,10 @@ def test_may_share_memory_cuda():
# can't test the transpose as ta._strides = is not implemented # can't test the transpose as ta._strides = is not implemented
# manual transpose of a # manual transpose of a
#ta = a.reshape((4,3)) # ta = a.reshape((4,3))
# ta._strides = (ta._strides[1],ta._strides[0])#not implemented # ta._strides = (ta._strides[1],ta._strides[0])#not implemented
#elem_size=elem_size = numpy.zeros(0,dtype=a.dtype).dtype.itemsize # elem_size=elem_size = numpy.zeros(0,dtype=a.dtype).dtype.itemsize
#ta.gpudata += ta.size*elem_size # ta.gpudata += ta.size*elem_size
for a_, b_, rep in [(a, a, True), (b, b, True), (a, b, False), for a_, b_, rep in [(a, a, True), (b, b, True), (a, b, False),
(a, na, False), (b, nb, False), (a, na, False), (b, nb, False),
...@@ -95,8 +94,7 @@ def test_may_share_memory_cuda(): ...@@ -95,8 +94,7 @@ def test_may_share_memory_cuda():
(a, va, True), (b, vb, True), (a, va, True), (b, vb, True),
(va, b, False), (a, vb, False), (va, b, False), (a, vb, False),
(a, ra, True), (b, rb, True), (a, ra, True), (b, rb, True),
(ra, b, False), (a, rb, False), (ra, b, False), (a, rb, False), ]:
]:
assert may_share_memory(a_, b_) == rep assert may_share_memory(a_, b_) == rep
assert may_share_memory(b_, a_) == rep assert may_share_memory(b_, a_) == rep
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论