[PT] Make error message from jit.trace more meaningful. (#75056)

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

At the moment if jit.trace is failing on unsupported return types, it's going
to be super hard to find exact operator that is causing trobules for fixing
this.

This diff improves logging to include operator name in additiona to the failed
type.

Test Plan:
Tested on one of the failed models. See which exact operator is causing
troubles.

Differential Revision: D35302222

fbshipit-source-id: 64fc4c850e226c16c435c0951215df4e634f23b5
(cherry picked from commit 928ce6b20936dfbaaaecca008a42fa297cf3eb7b)
This commit is contained in:
Andrey Malevich
2022-03-31 23:10:18 -07:00
committed by PyTorch MergeBot
parent 2bfa018462
commit e1ac97030a

View File

@ -283,7 +283,9 @@ void general_trace_function(
AT_ASSERT(iter->isObject());
tracer::addOutput(node, iter->toObject());
} else {
throw std::runtime_error("unsupported output type: " + type->str());
throw std::runtime_error(
"unsupported output type: " + type->str() +
", from operator: " + toString(op.operator_name()));
}
}
}