mirror of https://github.com/Jittor/Jittor
fix numpy code op test
This commit is contained in:
parent
ed65ba76e6
commit
e25a8ac28d
|
@ -7,7 +7,7 @@
|
||||||
# This file is subject to the terms and conditions defined in
|
# This file is subject to the terms and conditions defined in
|
||||||
# file 'LICENSE.txt', which is part of this source code package.
|
# file 'LICENSE.txt', which is part of this source code package.
|
||||||
# ***************************************************************
|
# ***************************************************************
|
||||||
__version__ = '1.1.7.4'
|
__version__ = '1.1.7.5'
|
||||||
from . import lock
|
from . import lock
|
||||||
with lock.lock_scope():
|
with lock.lock_scope():
|
||||||
from . import compiler
|
from . import compiler
|
||||||
|
|
|
@ -58,9 +58,9 @@ class TestCodeOp(unittest.TestCase):
|
||||||
one=numpy.ones(a.shape)
|
one=numpy.ones(a.shape)
|
||||||
assert numpy.allclose(da.data,one*2.0)
|
assert numpy.allclose(da.data,one*2.0)
|
||||||
|
|
||||||
jt.flags.use_cuda = 0
|
if jt.has_cuda:
|
||||||
check()
|
with jt.flag_scope(use_cuda=1):
|
||||||
jt.flags.use_cuda = 1
|
check()
|
||||||
check()
|
check()
|
||||||
|
|
||||||
def test(self):
|
def test(self):
|
||||||
|
@ -92,9 +92,9 @@ class TestCodeOp(unittest.TestCase):
|
||||||
one=numpy.ones(a.shape)
|
one=numpy.ones(a.shape)
|
||||||
assert numpy.allclose(da.data,one*2.0)
|
assert numpy.allclose(da.data,one*2.0)
|
||||||
|
|
||||||
jt.flags.use_cuda = 0
|
if jt.has_cuda:
|
||||||
check()
|
with jt.flag_scope(use_cuda=1):
|
||||||
jt.flags.use_cuda = 1
|
check()
|
||||||
check()
|
check()
|
||||||
|
|
||||||
def test_multi_input(self):
|
def test_multi_input(self):
|
||||||
|
@ -139,9 +139,9 @@ class TestCodeOp(unittest.TestCase):
|
||||||
assert numpy.allclose(dda.data,one)
|
assert numpy.allclose(dda.data,one)
|
||||||
assert numpy.allclose(ddb.data,mone)
|
assert numpy.allclose(ddb.data,mone)
|
||||||
|
|
||||||
jt.flags.use_cuda = 0
|
if jt.has_cuda:
|
||||||
check()
|
with jt.flag_scope(use_cuda=1):
|
||||||
jt.flags.use_cuda = 1
|
check()
|
||||||
check()
|
check()
|
||||||
|
|
||||||
@unittest.skipIf(True, "Memory leak testing is not in progress, Skip")
|
@unittest.skipIf(True, "Memory leak testing is not in progress, Skip")
|
||||||
|
|
|
@ -36,7 +36,7 @@ class TestParallelPass(unittest.TestCase):
|
||||||
b = jt.random((n, n))
|
b = jt.random((n, n))
|
||||||
a.data, b.data
|
a.data, b.data
|
||||||
with jt.profile_scope(compile_options = {
|
with jt.profile_scope(compile_options = {
|
||||||
"compile_shapes":1, "parallel":1
|
"compile_shapes":1, "parallel":2, "try_use_32bit_index":use_int32
|
||||||
}, try_use_32bit_index = use_int32) as rep:
|
}, try_use_32bit_index = use_int32) as rep:
|
||||||
c = a + b
|
c = a + b
|
||||||
nc = c.data
|
nc = c.data
|
||||||
|
|
Loading…
Reference in New Issue