improve error message on inferred type (#21058)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/21058
ghimport-source-id: e7d6e082b0faf4f3d3e683f2c98863ee269439f0

Differential Revision: D15534670

Pulled By: suo

fbshipit-source-id: 8bbfd6e9c1afbc3006d7d55ed633e18618e05021
This commit is contained in:
Michael Suo
2019-05-29 14:35:51 -07:00
committed by Facebook Github Bot
parent 6ea9044d3c
commit 5dacf6b048
13 changed files with 153 additions and 77 deletions
+6 -6
View File
@@ -62,9 +62,9 @@ TEST(TorchScriptTest, TestNestedIValueModuleArgMatching) {
} catch (const c10::Error& error) {
AT_ASSERT(
std::string(error.what_without_backtrace())
.find("Expected value of type Tensor[][] for argument 'a' in "
"position 0, but instead got value of type t[][][]") == 0);
.find("nested_loop() expected a value of type 'List[List[Tensor]]'"
" for argument 'a' but instead found type "
"'List[List[List[t]]]'") == 0);
};
std::vector<torch::jit::IValue> gen_list;
@@ -81,9 +81,9 @@ TEST(TorchScriptTest, TestNestedIValueModuleArgMatching) {
//so the error message is not helpful here.
AT_ASSERT(
std::string(error.what_without_backtrace())
.find("Expected value of type Tensor[][] for argument 'a' in "
"position 0, but instead got value of type Tensor[][]") == 0);
.find("nested_loop() expected a value of type "
"'List[List[Tensor]]' for argument 'a' but "
"instead found type 'List[List[Tensor]]'") == 0);
};
}