提交 427daa0d authored 作者: ChienliMa's avatar ChienliMa

Remove force fast_run mode

上级 98f6fde5
...@@ -18,7 +18,7 @@ class T_OpFromGraph(unittest_tools.InferShapeTester): ...@@ -18,7 +18,7 @@ class T_OpFromGraph(unittest_tools.InferShapeTester):
def test_straightforward(self): def test_straightforward(self):
x, y, z = T.matrices('xyz') x, y, z = T.matrices('xyz')
e = x + y * z e = x + y * z
op = OpFromGraph([x, y, z], [e], mode='FAST_RUN') op = OpFromGraph([x, y, z], [e])
# (1+3*5=array of 16) - (3+1*5=array of 8) # (1+3*5=array of 16) - (3+1*5=array of 8)
f = op(x, y, z) - op(y, z, x) f = op(x, y, z) - op(y, z, x)
...@@ -35,7 +35,7 @@ class T_OpFromGraph(unittest_tools.InferShapeTester): ...@@ -35,7 +35,7 @@ class T_OpFromGraph(unittest_tools.InferShapeTester):
def test_size_changes(self): def test_size_changes(self):
x, y, z = T.matrices('xyz') x, y, z = T.matrices('xyz')
e = T.dot(x, y) e = T.dot(x, y)
op = OpFromGraph([x, y], [e], mode='FAST_RUN') op = OpFromGraph([x, y], [e])
f = op(x, op(y, z)) f = op(x, op(y, z))
fn = function([x, y, z], f) fn = function([x, y, z], f)
xv = numpy.ones((2, 3), dtype=config.floatX) xv = numpy.ones((2, 3), dtype=config.floatX)
...@@ -51,7 +51,7 @@ class T_OpFromGraph(unittest_tools.InferShapeTester): ...@@ -51,7 +51,7 @@ class T_OpFromGraph(unittest_tools.InferShapeTester):
def test_grad(self): def test_grad(self):
x, y, z = T.matrices('xyz') x, y, z = T.matrices('xyz')
e = x + y * z e = x + y * z
op = OpFromGraph([x, y, z], [e], mode='FAST_RUN') op = OpFromGraph([x, y, z], [e])
f = op(x, y, z) f = op(x, y, z)
f = f - T.grad(T.sum(f), y) f = f - T.grad(T.sum(f), y)
fn = function([x, y, z], f) fn = function([x, y, z], f)
...@@ -63,7 +63,7 @@ class T_OpFromGraph(unittest_tools.InferShapeTester): ...@@ -63,7 +63,7 @@ class T_OpFromGraph(unittest_tools.InferShapeTester):
def test_grad_grad(self): def test_grad_grad(self):
x, y, z = T.matrices('xyz') x, y, z = T.matrices('xyz')
e = x + y * z e = x + y * z
op = OpFromGraph([x, y, z], [e], mode='FAST_RUN') op = OpFromGraph([x, y, z], [e])
f = op(x, y, z) f = op(x, y, z)
f = f - T.grad(T.sum(f), y) f = f - T.grad(T.sum(f), y)
f = f - T.grad(T.sum(f), y) f = f - T.grad(T.sum(f), y)
...@@ -77,7 +77,7 @@ class T_OpFromGraph(unittest_tools.InferShapeTester): ...@@ -77,7 +77,7 @@ class T_OpFromGraph(unittest_tools.InferShapeTester):
x, y, z = T.matrices('xyz') x, y, z = T.matrices('xyz')
s = shared(numpy.random.rand(2, 2).astype(config.floatX)) s = shared(numpy.random.rand(2, 2).astype(config.floatX))
e = x + y * z + s e = x + y * z + s
op = OpFromGraph([x, y, z], [e], mode='FAST_RUN') op = OpFromGraph([x, y, z], [e])
# (1+3*5=array of 16) - (3+1*5=array of 8) # (1+3*5=array of 16) - (3+1*5=array of 8)
f = op(x, y, z) - op(y, z, x) f = op(x, y, z) - op(y, z, x)
...@@ -94,7 +94,7 @@ class T_OpFromGraph(unittest_tools.InferShapeTester): ...@@ -94,7 +94,7 @@ class T_OpFromGraph(unittest_tools.InferShapeTester):
x, y, z = T.matrices('xyz') x, y, z = T.matrices('xyz')
s = shared(numpy.random.rand(2, 2).astype(config.floatX)) s = shared(numpy.random.rand(2, 2).astype(config.floatX))
e = x + y * z + s e = x + y * z + s
op = OpFromGraph([x, y, z], [e], mode='FAST_RUN') op = OpFromGraph([x, y, z], [e])
f = op(x, y, z) f = op(x, y, z)
f = f - T.grad(T.sum(f), y) f = f - T.grad(T.sum(f), y)
fn = function([x, y, z], f) fn = function([x, y, z], f)
...@@ -116,7 +116,7 @@ class T_OpFromGraph(unittest_tools.InferShapeTester): ...@@ -116,7 +116,7 @@ class T_OpFromGraph(unittest_tools.InferShapeTester):
out1 = x * y out1 = x * y
out2 = y * z out2 = y * z
op1 = OpFromGraph([x ,y, z], [out1, out2], mode='FAST_RUN') op1 = OpFromGraph([x ,y, z], [out1, out2])
results = op1.connection_pattern(None) results = op1.connection_pattern(None)
expect_result = [[True, False], expect_result = [[True, False],
[True, True], [True, True],
...@@ -128,7 +128,7 @@ class T_OpFromGraph(unittest_tools.InferShapeTester): ...@@ -128,7 +128,7 @@ class T_OpFromGraph(unittest_tools.InferShapeTester):
m, n, p, q = T.matrices('mnpq') m, n, p, q = T.matrices('mnpq')
o1, o2 = op1(m, n, p) o1, o2 = op1(m, n, p)
out1, out2 = op1(o1, q, o2) out1, out2 = op1(o1, q, o2)
op2 = OpFromGraph([m, n, p, q], [out1, out2], mode='FAST_RUN') op2 = OpFromGraph([m, n, p, q], [out1, out2])
results = op2.connection_pattern(None) results = op2.connection_pattern(None)
expect_result = [[True, False], expect_result = [[True, False],
...@@ -144,7 +144,7 @@ class T_OpFromGraph(unittest_tools.InferShapeTester): ...@@ -144,7 +144,7 @@ class T_OpFromGraph(unittest_tools.InferShapeTester):
out1 = x + rv_u out1 = x + rv_u
out2 = y + 3 out2 = y + 3
out3 = 3 + rv_u out3 = 3 + rv_u
op3 = OpFromGraph([x, y], [out1, out2, out3], mode='FAST_RUN') op3 = OpFromGraph([x, y], [out1, out2, out3])
results = op3.connection_pattern(None) results = op3.connection_pattern(None)
expect_result = [[True, False, False], expect_result = [[True, False, False],
...@@ -155,7 +155,7 @@ class T_OpFromGraph(unittest_tools.InferShapeTester): ...@@ -155,7 +155,7 @@ class T_OpFromGraph(unittest_tools.InferShapeTester):
def test_infer_shape(self): def test_infer_shape(self):
x = T.matrix('x') x = T.matrix('x')
y = x+x y = x+x
op_graph = OpFromGraph([x], [y], mode='FAST_RUN') op_graph = OpFromGraph([x], [y])
self._compile_and_check([x], self._compile_and_check([x],
[op_graph(x)], [op_graph(x)],
[numpy.ones([3,4], dtype=config.floatX)], [numpy.ones([3,4], dtype=config.floatX)],
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论