提交 6f3e360e authored 作者: David Warde-Farley's avatar David Warde-Farley

Test the .op, not the Apply node.

上级 9fc8bf1c
...@@ -100,8 +100,10 @@ class SparseInferShapeTester(unittest.TestCase): ...@@ -100,8 +100,10 @@ class SparseInferShapeTester(unittest.TestCase):
outputs_function = theano.function(inputs, outputs) outputs_function = theano.function(inputs, outputs)
shapes_function = theano.function(inputs, [o.shape for o in outputs]) shapes_function = theano.function(inputs, [o.shape for o in outputs])
# Check that the Op is removed from the compiled function. # Check that the Op is removed from the compiled function.
topo = shapes_function.maker.env.toposort() topo_shape = shapes_function.maker.env.toposort()
assert not any(isinstance(t, cls) for t in topo) assert not any(isinstance(t.op, cls) for t in topo_shape)
topo_out = outputs_function.maker.env.toposort()
assert any(isinstance(t.op, cls) for t in topo_out)
# Check that the shape produced agrees with the actual shape. # Check that the shape produced agrees with the actual shape.
numeric_outputs = outputs_function(*numeric_inputs) numeric_outputs = outputs_function(*numeric_inputs)
numeric_shapes = shapes_function(*numeric_inputs) numeric_shapes = shapes_function(*numeric_inputs)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论