提交 61c1d5cd authored 作者: Frederic Bastien's avatar Frederic Bastien

better formatting following review.

上级 49091e90
...@@ -654,7 +654,6 @@ class Test_aliasing_rules(unittest.TestCase): ...@@ -654,7 +654,6 @@ class Test_aliasing_rules(unittest.TestCase):
# rule #2 reading back from theano-managed memory # rule #2 reading back from theano-managed memory
assert not numpy.may_share_memory(A.get_value(borrow=False), data_of(A)) assert not numpy.may_share_memory(A.get_value(borrow=False), data_of(A))
def test_sparse_input_aliasing_affecting_inplace_operations(self): def test_sparse_input_aliasing_affecting_inplace_operations(self):
## ##
## Note this test will never fail because I am not aware of any ## Note this test will never fail because I am not aware of any
...@@ -662,7 +661,8 @@ class Test_aliasing_rules(unittest.TestCase): ...@@ -662,7 +661,8 @@ class Test_aliasing_rules(unittest.TestCase):
try: try:
import scipy.sparse as sp import scipy.sparse as sp
except ImportError: except ImportError:
pass#the variable enable_sparse will be used to disable the test file. # The variable enable_sparse will be used to disable the test file.
pass
from theano.sparse import enable_sparse from theano.sparse import enable_sparse
if enable_sparse == False: if enable_sparse == False:
...@@ -671,9 +671,9 @@ class Test_aliasing_rules(unittest.TestCase): ...@@ -671,9 +671,9 @@ class Test_aliasing_rules(unittest.TestCase):
from theano import sparse from theano import sparse
## Note: to trigger this bug with theano rev 4586:2bc6fc7f218b, ## Note: to trigger this bug with theano rev 4586:2bc6fc7f218b,
# you need to make in inputs mutable ( so that inplace # you need to make in inputs mutable (so that inplace
# operations are used) and to break the elemwise composition # operations are used) and to break the elemwise composition
# with some non-elemwise op ( here dot ) # with some non-elemwise op (here dot)
x = sparse.SparseType('csc', dtype = 'float64')() x = sparse.SparseType('csc', dtype = 'float64')()
y = sparse.SparseType('csc', dtype = 'float64')() y = sparse.SparseType('csc', dtype = 'float64')()
...@@ -702,15 +702,12 @@ class Test_aliasing_rules(unittest.TestCase): ...@@ -702,15 +702,12 @@ class Test_aliasing_rules(unittest.TestCase):
assert numpy.allclose(vals.todense(), bogus_vals.todense()) assert numpy.allclose(vals.todense(), bogus_vals.todense())
def test_input_aliasing_affecting_inplace_operations(self): def test_input_aliasing_affecting_inplace_operations(self):
## Note: to trigger this bug with theano rev 4586:2bc6fc7f218b, ## Note: to trigger this bug with theano rev 4586:2bc6fc7f218b,
# you need to make in inputs mutable ( so that inplace # you need to make in inputs mutable (so that inplace
# operations are used) and to break the elemwise composition # operations are used) and to break the elemwise composition
# with some non-elemwise op ( here dot ) # with some non-elemwise op (here dot)
x = theano.tensor.dvector() x = theano.tensor.dvector()
y = theano.tensor.dvector() y = theano.tensor.dvector()
m1 = theano.tensor.dmatrix() m1 = theano.tensor.dmatrix()
......
...@@ -822,10 +822,16 @@ def test_shared_float32(): ...@@ -822,10 +822,16 @@ def test_shared_float32():
import theano.tensor.tests.test_sharedvar import theano.tensor.tests.test_sharedvar
test_shared_options = theano.tensor.tests.test_sharedvar.makeSharedTester( test_shared_options = theano.tensor.tests.test_sharedvar.makeSharedTester(
tcn.shared_constructor, 'float32', False, False, False, shared_constructor_ = tcn.shared_constructor,
cuda_ndarray.CudaNdarray, dtype_ = 'float32',
lambda a: isinstance(a,cuda_ndarray.CudaNdarray), get_value_borrow_true_alias_ = False,
theano.tensor.exp, numpy.exp, shared_borrow_true_alias_ = False,
set_value_borrow_true_alias_ = False,
internal_type_ = cuda_ndarray.CudaNdarray,
test_internal_type_ = lambda a: isinstance(a,cuda_ndarray.CudaNdarray),
theano_fct_ = theano.tensor.exp,
ref_fct_ = numpy.exp,
cast_value_ = numpy.asarray,
add_matrix_ = True) add_matrix_ = True)
if __name__ == '__main__': if __name__ == '__main__':
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论