提交 f11ce936 authored 作者: Frederic Bastien's avatar Frederic Bastien

removed debug print and code not needed anymore since bug are fixed

上级 dc29b28f
......@@ -486,35 +486,6 @@ class ShapeOptimizer(Optimizer):
# -1 should make it run right before the first merge
theano.compile.mode.optdb.register('ShapeOpt', ShapeOptimizer(), -1, 'fast_run', 'fast_compile')
#This is a bug fix as ShapeFeature should do this, but it don't in the deep teaching tutorial.
@gof.local_optimizer([None, None])
def local_shape_i_lift(node):
"""
"Lifts" DimShuffle through Elemwise operations and merges
consecutive DimShuffles. Basically, applies the following
transformations on the whole graph:
DimShuffle(Elemwise(x, y)) => Elemwise(DimShuffle(x), DimShuffle(y))
DimShuffle(DimShuffle(x)) => DimShuffle(x)
After this transform, clusters of Elemwise operations are
void of DimShuffle operations.
"""
op = node.op
if not isinstance(op, Shape_i):
return False
input = node.inputs[0]
inode = input.owner
if inode and isinstance(inode.op, Elemwise) and inode.op.scalar_op.nin==1:
return node.env.shape_feature.shape_of[input]
## Disabled registration, because local_track_shape_i does the same (but better)
## TODO: remove local_shape_i_lift altogether
## -- Pascal L., 20100227.
#register_canonicalize(local_shape_i_lift)
#register_specialize(local_shape_i_lift)
@register_specialize
@register_canonicalize
@gof.local_optimizer([T.fill])
......@@ -568,9 +539,6 @@ def local_track_shape_i(node):
if node in shape_feature.scheduled:
assert isinstance(node.op, Shape_i)
replacement = shape_feature.scheduled[node]
#if len(shape_feature.shape_of[replacement])!=1:
#import pdb;pdb.set_trace()
print >> sys.stderr, "REPLACING SOMETHING", replacement, shape_feature.shape_of[replacement]
return [shape_feature.shape_of[replacement][node.op.i]]
@register_specialize
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论