mirror of
https://github.com/pytorch/pytorch.git
synced 2026-11-20 09:04:25 +08:00
fix tuple matching (#17687)
Summary: Check for Tuple Matching in isSubvalueOf, since they may contain container types that need to be recursed within isSubvalueOf Fix for https://github.com/pytorch/pytorch/issues/17650 Pull Request resolved: https://github.com/pytorch/pytorch/pull/17687 Differential Revision: D14324642 Pulled By: eellison fbshipit-source-id: 7f1e019875286b2640a3b9c003d1635dda8cf543
This commit is contained in:
committed by
Facebook Github Bot
parent
c658d9b21b
commit
10ea02facf
@@ -98,3 +98,17 @@ TEST(TorchScriptTest, TestDictArgMatching) {
|
||||
auto output = module->run_method("dict_op", dict, std::string("hello"));
|
||||
ASSERT_EQ(1, output.toTensor()[0].item<int64_t>());
|
||||
}
|
||||
|
||||
TEST(TorchScriptTest, TestTupleArgMatching) {
|
||||
auto module = torch::jit::compile(R"JIT(
|
||||
def tuple_op(a: Tuple[List[int]]):
|
||||
return a
|
||||
)JIT");
|
||||
|
||||
std::vector<int64_t> int_list = {1};
|
||||
auto tuple_generic_list = torch::jit::Tuple::create({ int_list });
|
||||
|
||||
// doesn't fail on arg matching
|
||||
module->run_method("tuple_op", tuple_generic_list);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user