add support for optional int list with scalar fill (#43262)

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

Test Plan: Imported from OSS

Reviewed By: ezyang

Differential Revision: D23212049

Pulled By: bhosmer

fbshipit-source-id: c7ceb2318645c07d36c3f932c981c9ee3c414f82
This commit is contained in:
Basil Hosmer
2020-08-21 18:22:53 -07:00
committed by Facebook GitHub Bot
parent f269fb83c1
commit a5a6a3e633
6 changed files with 100 additions and 21 deletions

View File

@ -18,6 +18,7 @@ using c10::ListType;
using c10::make_left;
using c10::make_right;
using c10::OperatorName;
using c10::OptionalType;
namespace torch {
namespace jit {
@ -109,7 +110,6 @@ struct SchemaParser {
}
Argument parseArgument(size_t idx, bool is_return, bool kwarg_only) {
Argument result;
auto p = type_parser.parseType();
auto type = std::move(p.first);
auto alias_info = std::move(p.second);
@ -127,6 +127,9 @@ struct SchemaParser {
container->addContainedType(std::move(*alias_info));
}
alias_info = std::move(container);
if (L.nextIf('?')) {
type = OptionalType::create(type);
}
}
if (is_return) {
// optionally field names in return values