提交 248bb200 authored 作者: Caglar's avatar Caglar

fixed the uncannonicalize.

上级 67821a34
...@@ -988,7 +988,7 @@ class ShapeFeature(object): ...@@ -988,7 +988,7 @@ class ShapeFeature(object):
# Do not call make_node for test_value # Do not call make_node for test_value
s = Shape_i(i)(r) s = Shape_i(i)(r)
try: try:
s = get_scalar_constant_value(s, only_process_constants=True) s = get_scalar_constant_value(s)
except NotScalarConstantError: except NotScalarConstantError:
pass pass
return s return s
...@@ -1058,7 +1058,7 @@ class ShapeFeature(object): ...@@ -1058,7 +1058,7 @@ class ShapeFeature(object):
assert len(idx) == 1 assert len(idx) == 1
idx = idx[0] idx = idx[0]
try: try:
i = get_scalar_constant_value(idx, only_process_constants=True) i = get_scalar_constant_value(idx)
except NotScalarConstantError: except NotScalarConstantError:
pass pass
else: else:
...@@ -1219,8 +1219,7 @@ class ShapeFeature(object): ...@@ -1219,8 +1219,7 @@ class ShapeFeature(object):
# The two following comparison are a speed optimization # The two following comparison are a speed optimization
# But we never timed this speed optimization! # But we never timed this speed optimization!
self.lscalar_one.equals(new_shape[idx]) or self.lscalar_one.equals(new_shape[idx]) or
self.lscalar_one.equals(T.extract_constant(new_shape[idx], self.lscalar_one.equals(T.extract_constant(new_shape[idx]))
only_process_constants=True))
for idx in xrange(r.ndim)]) for idx in xrange(r.ndim)])
self.shape_of[r] = tuple(new_shape) self.shape_of[r] = tuple(new_shape)
for sv in self.shape_of[r]: for sv in self.shape_of[r]:
...@@ -6036,7 +6035,7 @@ def constant_folding(node): ...@@ -6036,7 +6035,7 @@ def constant_folding(node):
required = thunk() required = thunk()
assert not required # a node whose inputs are all provided should always assert not required # a node whose inputs are all provided should always
# return successfully # return successfully
register_uncanonicalize(topo_constant_folding, 'fast_compile', final_opt=True)
rval = [] rval = []
for output in node.outputs: for output in node.outputs:
assert compute_map[output][0], (output, storage_map[output][0]) assert compute_map[output][0], (output, storage_map[output][0])
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论