Caffe2 - C++ API
A deep learning, cross platform ML framework
schema_type_parser.h
1 #include <ATen/ATen.h>
2 #include <ATen/core/jit_type.h>
3 #include <torch/csrc/jit/alias_info.h>
4 #include <torch/csrc/jit/script/lexer.h>
5 
6 namespace torch {
7 namespace jit {
8 namespace script {
9 
10 using TypePtr = c10::TypePtr;
11 using TypeAndAlias = std::pair<TypePtr, c10::optional<AliasInfo>>;
12 
14  TypeAndAlias parseBaseType();
15  c10::optional<AliasInfo> parseAliasAnnotation();
16  std::pair<TypePtr, c10::optional<AliasInfo>> parseType();
17  c10::optional<at::ScalarType> parseTensorDType(const std::string& dtype);
18  TypePtr parseRefinedTensor();
19 
20  SchemaTypeParser(Lexer& L, bool parse_complete_tensor_types) : L(L) {
21  complete_tensor_types = parse_complete_tensor_types;
22  }
23 
24  private:
25  void parseList(
26  int begin,
27  int sep,
28  int end,
29  const std::function<void()>& callback);
30 
31  bool complete_tensor_types;
32  Lexer& L;
33  size_t next_id = 0;
34 };
35 } // namespace script
36 } // namespace jit
37 } // namespace torch
Definition: jit_type.h:17