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

Make random_make_inplace test use full compilation pipeline

This will help make sure the optimization can be applied in a normal setting.
上级 186fad93
...@@ -65,20 +65,17 @@ def apply_local_opt_to_rv(opt, op_fn, dist_op, dist_params, size, rng): ...@@ -65,20 +65,17 @@ def apply_local_opt_to_rv(opt, op_fn, dist_op, dist_params, size, rng):
def test_inplace_optimization(): def test_inplace_optimization():
out = normal(0, 1) out = normal(0, 1)
out.owner.inputs[0].default_update = out.owner.outputs[0]
assert out.owner.op.inplace is False assert out.owner.op.inplace is False
inplace_mode = Mode(
"py", OptimizationQuery(include=["random_make_inplace"], exclude=[])
)
f = function( f = function(
[], [],
out, out,
mode=inplace_mode, mode="FAST_RUN",
) )
(new_out,) = f.maker.fgraph.outputs (new_out, new_rng) = f.maker.fgraph.outputs
assert new_out.type == out.type assert new_out.type == out.type
assert isinstance(new_out.owner.op, type(out.owner.op)) assert isinstance(new_out.owner.op, type(out.owner.op))
assert new_out.owner.op.inplace is True assert new_out.owner.op.inplace is True
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论