提交 82ecfff7 编写于 作者: A A. Unique TensorFlower 提交者: TensorFlower Gardener

Fix for constant folding where nodes with no inputs doesn't get constant folded.

Change: 115568214
上级 e752109e
......@@ -47,6 +47,12 @@ bool IsConstantFoldable(const Node* n,
if (n->IsControlFlow() || n->IsSend() || n->IsRecv()) {
return false;
}
if (n->IsSource()) {
return false;
}
if (n->IsSink()) {
return false;
}
return true;
}
......@@ -72,9 +78,9 @@ void FindConstantFoldableNodes(const Graph* graph, ConstantFoldingOptions opts,
// Check whether the set of this node's in_nodes is completely
// included in the set of constant foldable nodes. If true,
// then this node is also constant foldable.
bool all_parents_constant = n->num_inputs() > 0;
bool all_parents_constant = true;
for (const Node* parent : n->in_nodes()) {
if (node_set.count(parent) == 0) {
if (node_set.count(parent) == 0 && !parent->IsSource()) {
all_parents_constant = false;
break;
}
......
......@@ -9,7 +9,7 @@ load("//tensorflow/core:platform/default/build_config_root.bzl",
# List of proto files for android builds
def tf_android_core_proto_sources():
return [
"//google/protobuf", # any.proto
"//google/protobuf:any.proto",
"//tensorflow/core:example/example.proto",
"//tensorflow/core:example/feature.proto",
"//tensorflow/core:framework/allocation_description.proto",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册