Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JIT] Print out interface mismatch for prim::ModuleDictIndex #47300

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions torch/csrc/jit/python/python_sugared_value.cpp
Expand Up @@ -260,11 +260,13 @@ SugaredValuePtr ModuleValue::getitem(
for (size_t i = 0; i < self_type->numAttributes(); ++i) {
const auto& attr_type = self_type->getAttribute(i);
if (attr_type->is_module()) {
if (!attr_type->isSubtypeOf(type_hint)) {
std::stringstream ss;
if (!attr_type->isSubtypeOfExt(type_hint, &ss)) {
auto loc = self_->node()->sourceRange();
throw ErrorReport(loc)
<< "Attribute " << self_type->getAttributeName(i)
<< " is not of annotated type " << type_hint->annotation_str();
<< " is not of annotated type " << type_hint->annotation_str()
<< ": " << ss.str();
}
}
}
Expand Down