提交 7973d65f authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Brandon T. Willard

Use a local rng state instead of global in test_numba

上级 b6494726
...@@ -74,7 +74,7 @@ opts = OptimizationQuery(include=[None], exclude=["cxx_only", "BlasOpt"]) ...@@ -74,7 +74,7 @@ opts = OptimizationQuery(include=[None], exclude=["cxx_only", "BlasOpt"])
numba_mode = Mode(NumbaLinker(), opts) numba_mode = Mode(NumbaLinker(), opts)
py_mode = Mode("py", opts) py_mode = Mode("py", opts)
np.random.seed(42849) rng = np.random.RandomState(42849)
def set_test_value(x, v): def set_test_value(x, v):
...@@ -277,18 +277,18 @@ def test_create_numba_signature(v, expected, force_scalar): ...@@ -277,18 +277,18 @@ def test_create_numba_signature(v, expected, force_scalar):
[ [
( (
[aet.vector()], [aet.vector()],
[np.random.randn(100).astype(config.floatX)], [rng.randn(100).astype(config.floatX)],
lambda x: aet.sigmoid(x), lambda x: aet.sigmoid(x),
), ),
( (
[aet.vector() for i in range(4)], [aet.vector() for i in range(4)],
[np.random.randn(100).astype(config.floatX) for i in range(4)], [rng.randn(100).astype(config.floatX) for i in range(4)],
lambda x, y, x1, y1: (x + y) * (x1 + y1) * y, lambda x, y, x1, y1: (x + y) * (x1 + y1) * y,
), ),
( (
# This also tests the use of repeated arguments # This also tests the use of repeated arguments
[aet.matrix(), aet.scalar()], [aet.matrix(), aet.scalar()],
[np.random.normal(size=(2, 2)).astype(config.floatX), 0.0], [rng.normal(size=(2, 2)).astype(config.floatX), 0.0],
lambda a, b: aet.switch(a, b, a), lambda a, b: aet.switch(a, b, a),
), ),
], ],
...@@ -388,7 +388,7 @@ def test_AdvancedSubtensor(x, indices): ...@@ -388,7 +388,7 @@ def test_AdvancedSubtensor(x, indices):
), ),
( (
aet.as_tensor(np.arange(3 * 4 * 5).reshape((3, 4, 5))), aet.as_tensor(np.arange(3 * 4 * 5).reshape((3, 4, 5))),
aet.as_tensor(np.random.poisson(size=(4, 5))), aet.as_tensor(rng.poisson(size=(4, 5))),
(slice(None)), (slice(None)),
), ),
( (
...@@ -398,7 +398,7 @@ def test_AdvancedSubtensor(x, indices): ...@@ -398,7 +398,7 @@ def test_AdvancedSubtensor(x, indices):
), ),
( (
aet.as_tensor(np.arange(3 * 4 * 5).reshape((3, 4, 5))), aet.as_tensor(np.arange(3 * 4 * 5).reshape((3, 4, 5))),
aet.as_tensor(np.random.poisson(size=(1, 5))), aet.as_tensor(rng.poisson(size=(1, 5))),
(slice(1, 2), 1, slice(None)), (slice(1, 2), 1, slice(None)),
), ),
], ],
...@@ -426,12 +426,12 @@ def test_IncSubtensor(x, y, indices): ...@@ -426,12 +426,12 @@ def test_IncSubtensor(x, y, indices):
[ [
( (
aet.as_tensor(np.arange(3 * 4 * 5).reshape((3, 4, 5))), aet.as_tensor(np.arange(3 * 4 * 5).reshape((3, 4, 5))),
aet.as_tensor(np.random.poisson(size=(2, 4, 5))), aet.as_tensor(rng.poisson(size=(2, 4, 5))),
([1, 2],), ([1, 2],),
), ),
( (
aet.as_tensor(np.arange(3 * 4 * 5).reshape((3, 4, 5))), aet.as_tensor(np.arange(3 * 4 * 5).reshape((3, 4, 5))),
aet.as_tensor(np.random.poisson(size=(2, 4, 5))), aet.as_tensor(rng.poisson(size=(2, 4, 5))),
([1, 2], slice(None)), ([1, 2], slice(None)),
), ),
], ],
...@@ -459,12 +459,12 @@ def test_AdvancedIncSubtensor1(x, y, indices): ...@@ -459,12 +459,12 @@ def test_AdvancedIncSubtensor1(x, y, indices):
[ [
( (
aet.as_tensor(np.arange(3 * 4 * 5).reshape((3, 4, 5))), aet.as_tensor(np.arange(3 * 4 * 5).reshape((3, 4, 5))),
aet.as_tensor(np.random.poisson(size=(2, 5))), aet.as_tensor(rng.poisson(size=(2, 5))),
([1, 2], [2, 3]), ([1, 2], [2, 3]),
), ),
( (
aet.as_tensor(np.arange(3 * 4 * 5).reshape((3, 4, 5))), aet.as_tensor(np.arange(3 * 4 * 5).reshape((3, 4, 5))),
aet.as_tensor(np.random.poisson(size=(2, 4))), aet.as_tensor(rng.poisson(size=(2, 4))),
([1, 2], slice(None), [3, 4]), ([1, 2], slice(None), [3, 4]),
), ),
], ],
...@@ -979,10 +979,10 @@ def test_CAReduce(careduce_fn, axis, v): ...@@ -979,10 +979,10 @@ def test_CAReduce(careduce_fn, axis, v):
( (
( (
set_test_value( set_test_value(
aet.matrix(), np.random.normal(size=(1, 2)).astype(config.floatX) aet.matrix(), rng.normal(size=(1, 2)).astype(config.floatX)
), ),
set_test_value( set_test_value(
aet.matrix(), np.random.normal(size=(1, 2)).astype(config.floatX) aet.matrix(), rng.normal(size=(1, 2)).astype(config.floatX)
), ),
), ),
0, 0,
...@@ -990,10 +990,10 @@ def test_CAReduce(careduce_fn, axis, v): ...@@ -990,10 +990,10 @@ def test_CAReduce(careduce_fn, axis, v):
( (
( (
set_test_value( set_test_value(
aet.matrix(), np.random.normal(size=(2, 1)).astype(config.floatX) aet.matrix(), rng.normal(size=(2, 1)).astype(config.floatX)
), ),
set_test_value( set_test_value(
aet.matrix(), np.random.normal(size=(3, 1)).astype(config.floatX) aet.matrix(), rng.normal(size=(3, 1)).astype(config.floatX)
), ),
), ),
0, 0,
...@@ -1001,10 +1001,10 @@ def test_CAReduce(careduce_fn, axis, v): ...@@ -1001,10 +1001,10 @@ def test_CAReduce(careduce_fn, axis, v):
( (
( (
set_test_value( set_test_value(
aet.matrix(), np.random.normal(size=(1, 2)).astype(config.floatX) aet.matrix(), rng.normal(size=(1, 2)).astype(config.floatX)
), ),
set_test_value( set_test_value(
aet.matrix(), np.random.normal(size=(1, 2)).astype(config.floatX) aet.matrix(), rng.normal(size=(1, 2)).astype(config.floatX)
), ),
), ),
1, 1,
...@@ -1012,10 +1012,10 @@ def test_CAReduce(careduce_fn, axis, v): ...@@ -1012,10 +1012,10 @@ def test_CAReduce(careduce_fn, axis, v):
( (
( (
set_test_value( set_test_value(
aet.matrix(), np.random.normal(size=(2, 2)).astype(config.floatX) aet.matrix(), rng.normal(size=(2, 2)).astype(config.floatX)
), ),
set_test_value( set_test_value(
aet.matrix(), np.random.normal(size=(2, 1)).astype(config.floatX) aet.matrix(), rng.normal(size=(2, 1)).astype(config.floatX)
), ),
), ),
1, 1,
...@@ -1038,12 +1038,8 @@ def test_Join(vals, axis): ...@@ -1038,12 +1038,8 @@ def test_Join(vals, axis):
def test_Join_view(): def test_Join_view():
vals = ( vals = (
set_test_value( set_test_value(aet.matrix(), rng.normal(size=(2, 2)).astype(config.floatX)),
aet.matrix(), np.random.normal(size=(2, 2)).astype(config.floatX) set_test_value(aet.matrix(), rng.normal(size=(2, 2)).astype(config.floatX)),
),
set_test_value(
aet.matrix(), np.random.normal(size=(2, 2)).astype(config.floatX)
),
) )
g = aetb.Join(view=1)(1, *vals) g = aetb.Join(view=1)(1, *vals)
g_fg = FunctionGraph(outputs=[g]) g_fg = FunctionGraph(outputs=[g])
...@@ -1126,9 +1122,9 @@ def test_Eye(n, m, k, dtype): ...@@ -1126,9 +1122,9 @@ def test_Eye(n, m, k, dtype):
( (
[ [
set_test_value( set_test_value(
aet.matrix(), np.random.random(size=(2, 3)).astype(config.floatX) aet.matrix(), rng.random(size=(2, 3)).astype(config.floatX)
), ),
set_test_value(aet.lmatrix(), np.random.poisson(size=(2, 3))), set_test_value(aet.lmatrix(), rng.poisson(size=(2, 3))),
], ],
MySingleOut, MySingleOut,
UserWarning, UserWarning,
...@@ -1136,9 +1132,9 @@ def test_Eye(n, m, k, dtype): ...@@ -1136,9 +1132,9 @@ def test_Eye(n, m, k, dtype):
( (
[ [
set_test_value( set_test_value(
aet.matrix(), np.random.random(size=(2, 3)).astype(config.floatX) aet.matrix(), rng.random(size=(2, 3)).astype(config.floatX)
), ),
set_test_value(aet.lmatrix(), np.random.poisson(size=(2, 3))), set_test_value(aet.lmatrix(), rng.poisson(size=(2, 3))),
], ],
MyMultiOut, MyMultiOut,
UserWarning, UserWarning,
...@@ -1244,35 +1240,27 @@ def test_CumOp(val, axis, mode): ...@@ -1244,35 +1240,27 @@ def test_CumOp(val, axis, mode):
"val, n, axis", "val, n, axis",
[ [
( (
set_test_value( set_test_value(aet.matrix(), rng.normal(size=(3, 2)).astype(config.floatX)),
aet.matrix(), np.random.normal(size=(3, 2)).astype(config.floatX)
),
0, 0,
0, 0,
), ),
( (
set_test_value( set_test_value(aet.matrix(), rng.normal(size=(3, 2)).astype(config.floatX)),
aet.matrix(), np.random.normal(size=(3, 2)).astype(config.floatX)
),
0, 0,
1, 1,
), ),
( (
set_test_value( set_test_value(aet.matrix(), rng.normal(size=(3, 2)).astype(config.floatX)),
aet.matrix(), np.random.normal(size=(3, 2)).astype(config.floatX)
),
1, 1,
0, 0,
), ),
( (
set_test_value( set_test_value(aet.matrix(), rng.normal(size=(3, 2)).astype(config.floatX)),
aet.matrix(), np.random.normal(size=(3, 2)).astype(config.floatX)
),
1, 1,
1, 1,
), ),
( (
set_test_value(aet.lmatrix(), np.random.poisson(size=(3, 2))), set_test_value(aet.lmatrix(), rng.poisson(size=(3, 2))),
0, 0,
0, 0,
), ),
...@@ -1598,9 +1586,7 @@ def test_UnravelIndex(arr, shape, order, exc): ...@@ -1598,9 +1586,7 @@ def test_UnravelIndex(arr, shape, order, exc):
set_test_value( set_test_value(
aet.vector(), np.array([1.0, 2.0, 3.0], dtype=config.floatX) aet.vector(), np.array([1.0, 2.0, 3.0], dtype=config.floatX)
), ),
set_test_value( set_test_value(aet.matrix(), rng.random((3, 2)).astype(config.floatX)),
aet.matrix(), np.random.random((3, 2)).astype(config.floatX)
),
"left", "left",
None, None,
None, None,
...@@ -1631,9 +1617,7 @@ def test_UnravelIndex(arr, shape, order, exc): ...@@ -1631,9 +1617,7 @@ def test_UnravelIndex(arr, shape, order, exc):
set_test_value( set_test_value(
aet.vector(), np.array([1.0, 2.0, 3.0], dtype=config.floatX) aet.vector(), np.array([1.0, 2.0, 3.0], dtype=config.floatX)
), ),
set_test_value( set_test_value(aet.matrix(), rng.random((3, 2)).astype(config.floatX)),
aet.matrix(), np.random.random((3, 2)).astype(config.floatX)
),
"right", "right",
set_test_value(aet.lvector(), np.array([0, 2, 1])), set_test_value(aet.lvector(), np.array([0, 2, 1])),
UserWarning, UserWarning,
...@@ -1660,9 +1644,7 @@ def test_Searchsorted(a, v, side, sorter, exc): ...@@ -1660,9 +1644,7 @@ def test_Searchsorted(a, v, side, sorter, exc):
"x, shape, exc", "x, shape, exc",
[ [
( (
set_test_value( set_test_value(aet.vector(), rng.random(size=(2,)).astype(config.floatX)),
aet.vector(), np.random.random(size=(2,)).astype(config.floatX)
),
[set_test_value(aet.lscalar(), np.array(v)) for v in [3, 2]], [set_test_value(aet.lscalar(), np.array(v)) for v in [3, 2]],
UserWarning, UserWarning,
), ),
...@@ -1688,24 +1670,18 @@ def test_BroadcastTo(x, shape, exc): ...@@ -1688,24 +1670,18 @@ def test_BroadcastTo(x, shape, exc):
"x, y, exc", "x, y, exc",
[ [
( (
set_test_value( set_test_value(aet.matrix(), rng.random(size=(3, 2)).astype(config.floatX)),
aet.matrix(), np.random.random(size=(3, 2)).astype(config.floatX) set_test_value(aet.vector(), rng.random(size=(2,)).astype(config.floatX)),
),
set_test_value(
aet.vector(), np.random.random(size=(2,)).astype(config.floatX)
),
None, None,
), ),
( (
set_test_value(aet.lmatrix(), np.random.poisson(size=(3, 2))), set_test_value(aet.lmatrix(), rng.poisson(size=(3, 2))),
set_test_value( set_test_value(aet.fvector(), rng.random(size=(2,)).astype("float32")),
aet.fvector(), np.random.random(size=(2,)).astype("float32")
),
None, None,
), ),
( (
set_test_value(aet.lvector(), np.random.random(size=(2,)).astype(np.int64)), set_test_value(aet.lvector(), rng.random(size=(2,)).astype(np.int64)),
set_test_value(aet.lvector(), np.random.random(size=(2,)).astype(np.int64)), set_test_value(aet.lvector(), rng.random(size=(2,)).astype(np.int64)),
None, None,
), ),
], ],
...@@ -1730,15 +1706,11 @@ def test_Dot(x, y, exc): ...@@ -1730,15 +1706,11 @@ def test_Dot(x, y, exc):
"x, exc", "x, exc",
[ [
( (
set_test_value( set_test_value(aet.vector(), rng.random(size=(2,)).astype(config.floatX)),
aet.vector(), np.random.random(size=(2,)).astype(config.floatX)
),
None, None,
), ),
( (
set_test_value( set_test_value(aet.matrix(), rng.random(size=(2, 3)).astype(config.floatX)),
aet.matrix(), np.random.random(size=(2, 3)).astype(config.floatX)
),
None, None,
), ),
], ],
...@@ -1763,15 +1735,11 @@ def test_Softmax(x, exc): ...@@ -1763,15 +1735,11 @@ def test_Softmax(x, exc):
"x, exc", "x, exc",
[ [
( (
set_test_value( set_test_value(aet.vector(), rng.random(size=(2,)).astype(config.floatX)),
aet.vector(), np.random.random(size=(2,)).astype(config.floatX)
),
None, None,
), ),
( (
set_test_value( set_test_value(aet.matrix(), rng.random(size=(2, 3)).astype(config.floatX)),
aet.matrix(), np.random.random(size=(2, 3)).astype(config.floatX)
),
None, None,
), ),
], ],
...@@ -1846,23 +1814,17 @@ def test_Softplus(x, exc): ...@@ -1846,23 +1814,17 @@ def test_Softplus(x, exc):
None, None,
), ),
( (
set_test_value( set_test_value(aet.dvector(), rng.random(size=(3,)).astype("float64")),
aet.dvector(), np.random.random(size=(3,)).astype("float64")
),
[0], [0],
None, None,
), ),
( (
set_test_value( set_test_value(aet.dmatrix(), rng.random(size=(3, 2)).astype("float64")),
aet.dmatrix(), np.random.random(size=(3, 2)).astype("float64")
),
[0], [0],
None, None,
), ),
( (
set_test_value( set_test_value(aet.dmatrix(), rng.random(size=(3, 2)).astype("float64")),
aet.dmatrix(), np.random.random(size=(3, 2)).astype("float64")
),
[0, 1], [0, 1],
None, None,
), ),
...@@ -1894,7 +1856,7 @@ def test_MaxAndArgmax(x, axes, exc): ...@@ -1894,7 +1856,7 @@ def test_MaxAndArgmax(x, axes, exc):
( (
set_test_value( set_test_value(
aet.dmatrix(), aet.dmatrix(),
(lambda x: x.T.dot(x))(np.random.random(size=(3, 3)).astype("float64")), (lambda x: x.T.dot(x))(rng.random(size=(3, 3)).astype("float64")),
), ),
True, True,
None, None,
...@@ -1902,9 +1864,7 @@ def test_MaxAndArgmax(x, axes, exc): ...@@ -1902,9 +1864,7 @@ def test_MaxAndArgmax(x, axes, exc):
( (
set_test_value( set_test_value(
aet.lmatrix(), aet.lmatrix(),
(lambda x: x.T.dot(x))( (lambda x: x.T.dot(x))(rng.randint(1, 10, size=(3, 3)).astype("int64")),
np.random.randint(1, 10, size=(3, 3)).astype("int64")
),
), ),
True, True,
None, None,
...@@ -1912,7 +1872,7 @@ def test_MaxAndArgmax(x, axes, exc): ...@@ -1912,7 +1872,7 @@ def test_MaxAndArgmax(x, axes, exc):
( (
set_test_value( set_test_value(
aet.dmatrix(), aet.dmatrix(),
(lambda x: x.T.dot(x))(np.random.random(size=(3, 3)).astype("float64")), (lambda x: x.T.dot(x))(rng.random(size=(3, 3)).astype("float64")),
), ),
False, False,
UserWarning, UserWarning,
...@@ -1945,35 +1905,27 @@ def test_Cholesky(x, lower, exc): ...@@ -1945,35 +1905,27 @@ def test_Cholesky(x, lower, exc):
( (
set_test_value( set_test_value(
aet.dmatrix(), aet.dmatrix(),
(lambda x: x.T.dot(x))(np.random.random(size=(3, 3)).astype("float64")), (lambda x: x.T.dot(x))(rng.random(size=(3, 3)).astype("float64")),
),
set_test_value(
aet.dvector(), np.random.random(size=(3,)).astype("float64")
), ),
set_test_value(aet.dvector(), rng.random(size=(3,)).astype("float64")),
"general", "general",
None, None,
), ),
( (
set_test_value( set_test_value(
aet.lmatrix(), aet.lmatrix(),
(lambda x: x.T.dot(x))( (lambda x: x.T.dot(x))(rng.randint(1, 10, size=(3, 3)).astype("int64")),
np.random.randint(1, 10, size=(3, 3)).astype("int64")
),
),
set_test_value(
aet.dvector(), np.random.random(size=(3,)).astype("float64")
), ),
set_test_value(aet.dvector(), rng.random(size=(3,)).astype("float64")),
"general", "general",
None, None,
), ),
( (
set_test_value( set_test_value(
aet.dmatrix(), aet.dmatrix(),
(lambda x: x.T.dot(x))(np.random.random(size=(3, 3)).astype("float64")), (lambda x: x.T.dot(x))(rng.random(size=(3, 3)).astype("float64")),
),
set_test_value(
aet.dvector(), np.random.random(size=(3,)).astype("float64")
), ),
set_test_value(aet.dvector(), rng.random(size=(3,)).astype("float64")),
"lower_triangular", "lower_triangular",
UserWarning, UserWarning,
), ),
...@@ -2005,14 +1957,14 @@ def test_Solve(A, x, lower, exc): ...@@ -2005,14 +1957,14 @@ def test_Solve(A, x, lower, exc):
( (
set_test_value( set_test_value(
aet.dmatrix(), aet.dmatrix(),
(lambda x: x.T.dot(x))(np.random.random(size=(3, 3)).astype("float64")), (lambda x: x.T.dot(x))(rng.random(size=(3, 3)).astype("float64")),
), ),
None, None,
), ),
( (
set_test_value( set_test_value(
aet.lmatrix(), aet.lmatrix(),
(lambda x: x.T.dot(x))(np.random.poisson(size=(3, 3)).astype("int64")), (lambda x: x.T.dot(x))(rng.poisson(size=(3, 3)).astype("int64")),
), ),
None, None,
), ),
...@@ -2040,16 +1992,14 @@ def test_Det(x, exc): ...@@ -2040,16 +1992,14 @@ def test_Det(x, exc):
( (
set_test_value( set_test_value(
aet.dmatrix(), aet.dmatrix(),
(lambda x: x.T.dot(x))(np.random.random(size=(3, 3)).astype("float64")), (lambda x: x.T.dot(x))(rng.random(size=(3, 3)).astype("float64")),
), ),
None, None,
), ),
( (
set_test_value( set_test_value(
aet.lmatrix(), aet.lmatrix(),
(lambda x: x.T.dot(x))( (lambda x: x.T.dot(x))(rng.randint(1, 10, size=(3, 3)).astype("int64")),
np.random.randint(1, 10, size=(3, 3)).astype("int64")
),
), ),
None, None,
), ),
...@@ -2081,7 +2031,7 @@ def test_Eig(x, exc): ...@@ -2081,7 +2031,7 @@ def test_Eig(x, exc):
( (
set_test_value( set_test_value(
aet.dmatrix(), aet.dmatrix(),
(lambda x: x.T.dot(x))(np.random.random(size=(3, 3)).astype("float64")), (lambda x: x.T.dot(x))(rng.random(size=(3, 3)).astype("float64")),
), ),
"L", "L",
None, None,
...@@ -2089,9 +2039,7 @@ def test_Eig(x, exc): ...@@ -2089,9 +2039,7 @@ def test_Eig(x, exc):
( (
set_test_value( set_test_value(
aet.lmatrix(), aet.lmatrix(),
(lambda x: x.T.dot(x))( (lambda x: x.T.dot(x))(rng.randint(1, 10, size=(3, 3)).astype("int64")),
np.random.randint(1, 10, size=(3, 3)).astype("int64")
),
), ),
"U", "U",
UserWarning, UserWarning,
...@@ -2124,16 +2072,14 @@ def test_Eigh(x, uplo, exc): ...@@ -2124,16 +2072,14 @@ def test_Eigh(x, uplo, exc):
( (
set_test_value( set_test_value(
aet.dmatrix(), aet.dmatrix(),
(lambda x: x.T.dot(x))(np.random.random(size=(3, 3)).astype("float64")), (lambda x: x.T.dot(x))(rng.random(size=(3, 3)).astype("float64")),
), ),
None, None,
), ),
( (
set_test_value( set_test_value(
aet.lmatrix(), aet.lmatrix(),
(lambda x: x.T.dot(x))( (lambda x: x.T.dot(x))(rng.randint(1, 10, size=(3, 3)).astype("int64")),
np.random.randint(1, 10, size=(3, 3)).astype("int64")
),
), ),
None, None,
), ),
...@@ -2161,7 +2107,7 @@ def test_MatrixInverse(x, exc): ...@@ -2161,7 +2107,7 @@ def test_MatrixInverse(x, exc):
( (
set_test_value( set_test_value(
aet.dmatrix(), aet.dmatrix(),
(lambda x: x.T.dot(x))(np.random.random(size=(3, 3)).astype("float64")), (lambda x: x.T.dot(x))(rng.random(size=(3, 3)).astype("float64")),
), ),
"reduced", "reduced",
None, None,
...@@ -2169,7 +2115,7 @@ def test_MatrixInverse(x, exc): ...@@ -2169,7 +2115,7 @@ def test_MatrixInverse(x, exc):
( (
set_test_value( set_test_value(
aet.dmatrix(), aet.dmatrix(),
(lambda x: x.T.dot(x))(np.random.random(size=(3, 3)).astype("float64")), (lambda x: x.T.dot(x))(rng.random(size=(3, 3)).astype("float64")),
), ),
"r", "r",
None, None,
...@@ -2177,9 +2123,7 @@ def test_MatrixInverse(x, exc): ...@@ -2177,9 +2123,7 @@ def test_MatrixInverse(x, exc):
( (
set_test_value( set_test_value(
aet.lmatrix(), aet.lmatrix(),
(lambda x: x.T.dot(x))( (lambda x: x.T.dot(x))(rng.randint(1, 10, size=(3, 3)).astype("int64")),
np.random.randint(1, 10, size=(3, 3)).astype("int64")
),
), ),
"reduced", "reduced",
None, None,
...@@ -2187,9 +2131,7 @@ def test_MatrixInverse(x, exc): ...@@ -2187,9 +2131,7 @@ def test_MatrixInverse(x, exc):
( (
set_test_value( set_test_value(
aet.lmatrix(), aet.lmatrix(),
(lambda x: x.T.dot(x))( (lambda x: x.T.dot(x))(rng.randint(1, 10, size=(3, 3)).astype("int64")),
np.random.randint(1, 10, size=(3, 3)).astype("int64")
),
), ),
"complete", "complete",
UserWarning, UserWarning,
...@@ -2222,7 +2164,7 @@ def test_QRFull(x, mode, exc): ...@@ -2222,7 +2164,7 @@ def test_QRFull(x, mode, exc):
( (
set_test_value( set_test_value(
aet.dmatrix(), aet.dmatrix(),
(lambda x: x.T.dot(x))(np.random.random(size=(3, 3)).astype("float64")), (lambda x: x.T.dot(x))(rng.random(size=(3, 3)).astype("float64")),
), ),
True, True,
True, True,
...@@ -2231,7 +2173,7 @@ def test_QRFull(x, mode, exc): ...@@ -2231,7 +2173,7 @@ def test_QRFull(x, mode, exc):
( (
set_test_value( set_test_value(
aet.dmatrix(), aet.dmatrix(),
(lambda x: x.T.dot(x))(np.random.random(size=(3, 3)).astype("float64")), (lambda x: x.T.dot(x))(rng.random(size=(3, 3)).astype("float64")),
), ),
False, False,
True, True,
...@@ -2240,9 +2182,7 @@ def test_QRFull(x, mode, exc): ...@@ -2240,9 +2182,7 @@ def test_QRFull(x, mode, exc):
( (
set_test_value( set_test_value(
aet.lmatrix(), aet.lmatrix(),
(lambda x: x.T.dot(x))( (lambda x: x.T.dot(x))(rng.randint(1, 10, size=(3, 3)).astype("int64")),
np.random.randint(1, 10, size=(3, 3)).astype("int64")
),
), ),
True, True,
True, True,
...@@ -2251,9 +2191,7 @@ def test_QRFull(x, mode, exc): ...@@ -2251,9 +2191,7 @@ def test_QRFull(x, mode, exc):
( (
set_test_value( set_test_value(
aet.lmatrix(), aet.lmatrix(),
(lambda x: x.T.dot(x))( (lambda x: x.T.dot(x))(rng.randint(1, 10, size=(3, 3)).astype("int64")),
np.random.randint(1, 10, size=(3, 3)).astype("int64")
),
), ),
True, True,
False, False,
...@@ -2287,22 +2225,22 @@ def test_SVD(x, full_matrices, compute_uv, exc): ...@@ -2287,22 +2225,22 @@ def test_SVD(x, full_matrices, compute_uv, exc):
( (
set_test_value( set_test_value(
aet.dmatrix(), aet.dmatrix(),
np.random.random(size=(3, 3)).astype("float64"), rng.random(size=(3, 3)).astype("float64"),
), ),
set_test_value( set_test_value(
aet.dmatrix(), aet.dmatrix(),
np.random.random(size=(3, 3)).astype("float64"), rng.random(size=(3, 3)).astype("float64"),
), ),
None, None,
), ),
( (
set_test_value( set_test_value(
aet.dmatrix(), aet.dmatrix(),
np.random.random(size=(3, 3)).astype("float64"), rng.random(size=(3, 3)).astype("float64"),
), ),
set_test_value( set_test_value(
aet.lmatrix(), aet.lmatrix(),
np.random.poisson(size=(3, 3)).astype("int64"), rng.poisson(size=(3, 3)).astype("int64"),
), ),
None, None,
), ),
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论