提交 8dbc513a authored 作者: Frederic's avatar Frederic

Small modif to make the output of get_canonical_form_slice() simpler<

and test that the opt was applied.
上级 494a4c6f
...@@ -100,6 +100,7 @@ def get_canonical_form_slice(theslice, length): ...@@ -100,6 +100,7 @@ def get_canonical_form_slice(theslice, length):
if step is None: if step is None:
step = 1 step = 1
is_step_constant = True
# First handle the easier and common case where `step` is 1 and # First handle the easier and common case where `step` is 1 and
# either `start` or `stop` is a range boundary. More specializations # either `start` or `stop` is a range boundary. More specializations
......
...@@ -2408,10 +2408,10 @@ def test_local_subtensor_of_alloc(): ...@@ -2408,10 +2408,10 @@ def test_local_subtensor_of_alloc():
for slices in slicess: for slices in slicess:
z = yx.__getitem__(slices) z = yx.__getitem__(slices)
f = theano.function([x], z) f = theano.function([x], z)
# theano.printing.debugprint(f) if theano.config.mode != 'FAST_COMPILE':
# if theano.config.mode != 'FAST_COMPILE': # Subtensor can be in the input of Alloc
# assert not any([isinstance(node.op, Subtensor) assert not isinstance(f.maker.fgraph.toposort()[-1].op,
# for node in f.maker.fgraph.toposort()]) Subtensor)
val = f(xval) val = f(xval)
assert xval.__getitem__(slices).shape == val.shape assert xval.__getitem__(slices).shape == val.shape
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论