Remove old exceptions as post removal date
PiperOrigin-RevId: 303746718 Change-Id: Ie44c59dc00a84a58d6c68312e39ec47d51da34be
This commit is contained in:
parent
b43f1e0072
commit
367629f45a
tensorflow
@ -821,56 +821,10 @@ Status GraphConstructor::ValidateShape(Node* node) {
|
||||
}
|
||||
s = refiner_->SetShape(node, i, h);
|
||||
if (!s.ok()) {
|
||||
// If the output shape is incompatible with what is inferred
|
||||
// by the graph for a very specific whitelist of ops, then we
|
||||
// ignore this output shape. This can happen if there is a
|
||||
// bug in the shape function for some operation, and the
|
||||
// serialized graph def has the incorrect shape set when
|
||||
// running on a newer binary with the fixed shape function.
|
||||
// This is an escape hatch that allows us to correct shape
|
||||
// functions that are not critical to correct execution but
|
||||
// would cause graphs to fail if imported after correcting.
|
||||
const string& op = node->type_string();
|
||||
const std::vector<string> whitelist = {
|
||||
// To be removed after 2017/03/08.
|
||||
"RandomShuffleQueue",
|
||||
"PaddingFIFOQueue",
|
||||
"FIFOQueue",
|
||||
"PriorityQueue",
|
||||
"QueueSize",
|
||||
"Stack",
|
||||
"Barrier",
|
||||
"BarrierReadySize",
|
||||
"BarrierIncompleteSize",
|
||||
"HashTable",
|
||||
"MutableHashTable",
|
||||
"MutableHashTableOfTensors",
|
||||
"Mutex",
|
||||
"CuckooTable",
|
||||
"IndexTable",
|
||||
"WholeFileReader",
|
||||
"TextLineReader",
|
||||
"FixedLengthRecordReader",
|
||||
"TFRecordReader",
|
||||
"IdentityReader",
|
||||
"RefSwitch",
|
||||
"RefEnter",
|
||||
"RefNextIteration",
|
||||
"RefMerge",
|
||||
"RefIdentity",
|
||||
"LMDBReader",
|
||||
// To be removed after 2017/04/24.
|
||||
"ConditionalAccumulator",
|
||||
"SparseConditionalAccumulator",
|
||||
"Table",
|
||||
};
|
||||
if (std::find(whitelist.begin(), whitelist.end(), op) ==
|
||||
whitelist.end()) {
|
||||
return errors::InvalidArgument(
|
||||
"Node '", node->name(), "' has an ", kAttrName,
|
||||
" attribute inconsistent with the GraphDef for output #", i, ": ",
|
||||
s.error_message());
|
||||
}
|
||||
return errors::InvalidArgument(
|
||||
"Node '", node->name(), "' has an ", kAttrName,
|
||||
" attribute inconsistent with the GraphDef for output #", i, ": ",
|
||||
s.error_message());
|
||||
}
|
||||
}
|
||||
node->ClearAttr(kAttrName);
|
||||
|
@ -1172,31 +1172,6 @@ node {
|
||||
<< s;
|
||||
}
|
||||
|
||||
TEST_F(GraphConstructorTest, ImportGraphDef_ShapeWhitelist) {
|
||||
// Barrier's shape is an output vector of 2, but the graph says it's a vector
|
||||
// of 1. This is currently whitelisted.
|
||||
GraphDef def;
|
||||
bool parsed = protobuf::TextFormat::ParseFromString(
|
||||
R"EOF(
|
||||
node {
|
||||
name: "A"
|
||||
op: "Barrier"
|
||||
attr {
|
||||
key: "_output_shapes"
|
||||
value { list { shape {} } }
|
||||
}
|
||||
attr {
|
||||
key: "component_types"
|
||||
value { list { type: DT_FLOAT } }
|
||||
}
|
||||
}
|
||||
)EOF",
|
||||
&def);
|
||||
ASSERT_TRUE(parsed);
|
||||
Status s = ImportGraphDef(ImportGraphDefOptions(), def, &graph_, nullptr);
|
||||
EXPECT_EQ(Status::OK(), s) << s;
|
||||
}
|
||||
|
||||
TEST_F(GraphConstructorTest, ImportGraphDef_InputMap) {
|
||||
ShapeRefiner refiner(TF_GRAPH_DEF_VERSION, graph_.op_registry());
|
||||
|
||||
|
@ -472,21 +472,6 @@ class ImportGraphDefTest(test.TestCase):
|
||||
node { name: 'B' op: 'FloatInput' input: 'A:0' }
|
||||
"""))
|
||||
|
||||
def testShapeWhitelist(self):
|
||||
# Barrier's shape is an output vector of 2, but the
|
||||
# graph says it's a scalar. This is currently whitelisted.
|
||||
with ops.Graph().as_default():
|
||||
_ = importer.import_graph_def(
|
||||
self._MakeGraphDef("""
|
||||
node { name: 'A' op: 'Barrier'
|
||||
attr { key: '_output_shapes'
|
||||
value { list { shape { } } } }
|
||||
attr { key: 'component_types'
|
||||
value { list { type: DT_FLOAT } } } }
|
||||
"""),
|
||||
return_elements=["A"],
|
||||
name="import")
|
||||
|
||||
def testShapeWhitelistViolation(self):
|
||||
# L2 loss produces a scalar shape, but the graph
|
||||
# has the wrong shape, so raise an error.
|
||||
|
Loading…
Reference in New Issue
Block a user