Check both output name and output slot in duplicate scope id sanity check.

Before this change, we would throw an error if different outputs of a node were
committed to different scope ids.  Since that is legal, this change fixes the
bug by making the check based on both output name and output index.

PiperOrigin-RevId: 263482156
This commit is contained in:
Ayush Dubey 2019-08-14 19:39:05 -07:00 committed by TensorFlower Gardener
parent f2be0e04c6
commit dcdca11bcb

View File

@ -312,7 +312,9 @@ class UnaryElementwiseRewriter : public ScopedAllocatorOptimizer::Rewriter {
AttrSlice n_attrs = AttrSlice(*nd.from_node_def);
std::vector<int32> scope_ids;
Status ss = GetNodeAttr(n_attrs, kScopedAllocatorAttrName, &scope_ids);
if (ss.ok()) {
// Check that both output name and output slot match. It is okay to have
// different outputs of the input committed to different scope ids.
if (ss.ok() && scope_ids[0] == nd.output_slot) {
LOG(INFO) << "Abandoning ScopedAllocatorOptimizer because input "
<< nd.from_node_def->name() << " output " << scope_ids[0]
<< " is already assigned to scope_id " << scope_ids[1];