提交 45c446f1 authored 作者: Frederic's avatar Frederic

Make shape feature prefer constant.

上级 2fc470e2
...@@ -928,6 +928,10 @@ class ShapeFeature(object): ...@@ -928,6 +928,10 @@ class ShapeFeature(object):
# - Shape_i(i)(other_r); # - Shape_i(i)(other_r);
# - Shape_i(i)(r). # - Shape_i(i)(r).
merged_shape.append(r_shape[i]) merged_shape.append(r_shape[i])
elif isinstance(r_shape[i], Constant):
# We do this to call less often ancestors and make
# sure we have the simplest shape possible.
merged_shape.append(r_shape[i])
elif r_shape[i] in theano.gof.graph.ancestors([other_shape[i]]): elif r_shape[i] in theano.gof.graph.ancestors([other_shape[i]]):
# Another case where we want to use r_shape[i] is when # Another case where we want to use r_shape[i] is when
# other_shape[i] actually depends on r_shape[i]. In that case, # other_shape[i] actually depends on r_shape[i]. In that case,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论