xref: /aosp_15_r20/external/pytorch/torch/csrc/jit/frontend/function_schema_parser.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #pragma once
2 
3 #include <ATen/core/function_schema.h>
4 #include <c10/macros/Macros.h>
5 #include <string>
6 #include <variant>
7 
8 namespace torch::jit {
9 
10 // allow_typevars: If true, we assume that lowercase types that we don't
11 // understand are type variables. This is only needed for TorchScript (and not
12 // not needed for custom ops).
13 // If false, we disallow typevars, except in certain cases for BC reason (i.e.
14 // your op is in the aten or prim namespace).
15 TORCH_API std::variant<c10::OperatorName, c10::FunctionSchema> parseSchemaOrName(
16     const std::string& schemaOrName,
17     bool allow_typevars = true);
18 TORCH_API c10::FunctionSchema parseSchema(
19     const std::string& schema,
20     bool allow_typevars = true);
21 TORCH_API c10::OperatorName parseName(const std::string& name);
22 
23 } // namespace torch::jit
24