mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Revert "Verify types in custom op schemas (#124520)"
This reverts commit 5b98d43488bed0836b4da5996a50bafd0dd2c11c. Reverted https://github.com/pytorch/pytorch/pull/124520 on behalf of https://github.com/zou3519 due to broke static runtime tests ([comment](https://github.com/pytorch/pytorch/pull/124520#issuecomment-2075111935))
This commit is contained in:
@ -23,14 +23,14 @@ namespace torch::jit {
|
||||
|
||||
namespace {
|
||||
struct SchemaParser {
|
||||
explicit SchemaParser(const std::string& str, bool allow_typevars)
|
||||
explicit SchemaParser(const std::string& str)
|
||||
: L(std::make_shared<Source>(
|
||||
c10::string_view(str),
|
||||
c10::nullopt,
|
||||
0,
|
||||
nullptr,
|
||||
Source::DONT_COPY)),
|
||||
type_parser(L, /*parse_complete_tensor_types*/ false, allow_typevars) {}
|
||||
type_parser(L, /*parse_complete_tensor_types*/ false) {}
|
||||
|
||||
std::variant<OperatorName, FunctionSchema> parseDeclaration() {
|
||||
OperatorName name = parseName();
|
||||
@ -361,19 +361,16 @@ struct SchemaParser {
|
||||
}
|
||||
Lexer L;
|
||||
SchemaTypeParser type_parser;
|
||||
bool allow_typevars_;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
std::variant<OperatorName, FunctionSchema> parseSchemaOrName(
|
||||
const std::string& schemaOrName,
|
||||
bool allow_typevars) {
|
||||
return SchemaParser(schemaOrName, allow_typevars)
|
||||
.parseExactlyOneDeclaration();
|
||||
const std::string& schemaOrName) {
|
||||
return SchemaParser(schemaOrName).parseExactlyOneDeclaration();
|
||||
}
|
||||
|
||||
FunctionSchema parseSchema(const std::string& schema, bool allow_typevars) {
|
||||
auto parsed = parseSchemaOrName(schema, allow_typevars);
|
||||
FunctionSchema parseSchema(const std::string& schema) {
|
||||
auto parsed = parseSchemaOrName(schema);
|
||||
TORCH_CHECK(
|
||||
std::holds_alternative<FunctionSchema>(parsed),
|
||||
"Tried to parse a function schema but only the operator name was given");
|
||||
|
Reference in New Issue
Block a user