Disambiguate error message for working with not fully refined tuple types (#55745)

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/55745

Test Plan: Imported from OSS

Reviewed By: gmagogsfm

Differential Revision: D27698691

Pulled By: tugsbayasgalan

fbshipit-source-id: 7855042d37290f19d53adfc0b4da606430501663
This commit is contained in:
Tugsbayasgalan Manlaibaatar
2021-04-11 02:28:49 -07:00
committed by Facebook GitHub Bot
parent facbcec298
commit b80c6f863f
2 changed files with 11 additions and 0 deletions

View File

@ -238,6 +238,9 @@ std::vector<std::shared_ptr<SugaredValue>> SimpleValue::asTuple(
Node* unpack =
graph->insertNode(graph->createListUnpack(value_, *size_hint));
return fmap(unpack->outputs(), make_simple_value);
} else if (value_->type()->kind() == TypeKind::AnyTupleType) {
throw ErrorReport(loc)
<< "Provided tuple is not fully defined/refined including its element types, please provide a value of type like Tuple[int, int]";
}
throw ErrorReport(loc) << value_->type()->repr_str()
<< " cannot be used as a tuple";