xref: /aosp_15_r20/external/pytorch/c10/util/FbcodeMaps.h (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 #ifndef C10_UTIL_FBCODEMAPS_H_
2 #define C10_UTIL_FBCODEMAPS_H_
3 
4 // Map typedefs so that we can use folly's F14 maps in fbcode without
5 // taking a folly dependency.
6 
7 #ifdef FBCODE_CAFFE2
8 #include <folly/container/F14Map.h>
9 #include <folly/container/F14Set.h>
10 #else
11 #include <unordered_map>
12 #include <unordered_set>
13 #endif
14 
15 namespace c10 {
16 #ifdef FBCODE_CAFFE2
17 template <typename Key, typename Value>
18 using FastMap = folly::F14FastMap<Key, Value>;
19 template <typename Key>
20 using FastSet = folly::F14FastSet<Key>;
21 #else
22 template <typename Key, typename Value>
23 using FastMap = std::unordered_map<Key, Value>;
24 template <typename Key>
25 using FastSet = std::unordered_set<Key>;
26 #endif
27 } // namespace c10
28 
29 #endif // C10_UTIL_FBCODEMAPS_H_
30