提交 7608602e authored 作者: khaotik's avatar khaotik 提交者: khaotik

bug fix/cleanups

- Moved old docstring in OpFromGraph to function op_from_graph - Added an new example for op_from_graph docstring - now we can access `theano.op_from_graph` and `theano.OpFromGraph<Inline|Precompiled>` in `unittesttools.py`: ``` if check_topo: topo_shape = shapes_function.maker.fgraph.toposort() assert not any(isinstance(t.op, cls) for t in topo_shape) topo_out = outputs_function.maker.fgraph.toposort() assert any(isinstance(t.op, cls) for t in topo_out) ``` This seems to check existence of op in `topo_out` regardless `check_topo`. Since OpFromGraphInline will be replaced with its internal graph at compile time, this check will always cause error. Thus I moved them inside the `if` clause.
上级 85a1ae51
...@@ -68,7 +68,8 @@ from theano.compile import ( ...@@ -68,7 +68,8 @@ from theano.compile import (
SymbolicOutput, Out, SymbolicOutput, Out,
Mode, Mode,
predefined_modes, predefined_linkers, predefined_optimizers, predefined_modes, predefined_linkers, predefined_optimizers,
FunctionMaker, function, function_dump, OpFromGraph, FunctionMaker, function, function_dump,
OpFromGraph, OpFromGrpahInline, OpFromGraphPrecompiled, op_from_graph
ProfileStats, ProfileStats,
Param, shared, as_op) Param, shared, as_op)
......
差异被折叠。
...@@ -244,8 +244,8 @@ class InferShapeTester(unittest.TestCase): ...@@ -244,8 +244,8 @@ class InferShapeTester(unittest.TestCase):
# Check that the Op is removed from the compiled function. # Check that the Op is removed from the compiled function.
if check_topo: if check_topo:
topo_shape = shapes_function.maker.fgraph.toposort() topo_shape = shapes_function.maker.fgraph.toposort()
assert not any(isinstance(t.op, cls) for t in topo_shape)
topo_out = outputs_function.maker.fgraph.toposort() topo_out = outputs_function.maker.fgraph.toposort()
assert not any(isinstance(t.op, cls) for t in topo_shape)
assert any(isinstance(t.op, cls) for t in topo_out) 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)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论