Caffe2 - C++ API
A deep learning, cross platform ML framework
interned_strings_class.h
1 #include <cstdint>
2 #include <cstring>
3 #include <iostream>
4 #include <mutex>
5 #include <sstream>
6 #include <string>
7 #include <unordered_map>
8 #include <vector>
9 #include <ATen/core/interned_strings.h>
10 #include <c10/util/Exception.h>
11 
12 namespace c10 {
13 
14 struct CAFFE2_API InternedStrings {
16  Symbol symbol(const std::string& s);
17  std::pair<const char*, const char*> string(Symbol sym);
18  Symbol ns(Symbol sym);
19 
20  private:
21  // prereq - holding mutex_
22  Symbol _symbol(const std::string& s);
23  std::pair<const char*, const char*> customString(Symbol sym);
24  std::unordered_map<std::string, Symbol> string_to_sym_;
25 
26  struct SymbolInfo {
27  Symbol ns;
28  std::string qual_name;
29  std::string unqual_name;
30  };
31  std::vector<SymbolInfo> sym_to_info_;
32 
33  std::mutex mutex_;
34 };
35 
36 } // namespace c10
To register your own kernel for an operator, do in one (!) cpp file: C10_REGISTER_KERNEL(OperatorHand...
Definition: alias_info.h:7