mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
Allow us to use folly maps in fbcode and std maps for compatibility in OSS, extending what static runtime is already doing. Differential Revision: [D43926670](https://our.internmc.facebook.com/intern/diff/D43926670/) Pull Request resolved: https://github.com/pytorch/pytorch/pull/96359 Approved by: https://github.com/ezyang
30 lines
728 B
C++
30 lines
728 B
C++
#ifndef C10_UTIL_FBCODEMAPS_H_
|
|
#define C10_UTIL_FBCODEMAPS_H_
|
|
|
|
// Map typedefs so that we can use folly's F14 maps in fbcode without
|
|
// taking a folly dependency.
|
|
|
|
#ifdef FBCODE_CAFFE2
|
|
#include <folly/container/F14Map.h>
|
|
#include <folly/container/F14Set.h>
|
|
#else
|
|
#include <unordered_map>
|
|
#include <unordered_set>
|
|
#endif
|
|
|
|
namespace c10 {
|
|
#ifdef FBCODE_CAFFE2
|
|
template <typename Key, typename Value>
|
|
using FastMap = folly::F14FastMap<Key, Value>;
|
|
template <typename Key>
|
|
using FastSet = folly::F14FastSet<Key>;
|
|
#else
|
|
template <typename Key, typename Value>
|
|
using FastMap = std::unordered_map<Key, Value>;
|
|
template <typename Key>
|
|
using FastSet = std::unordered_set<Key>;
|
|
#endif
|
|
} // namespace c10
|
|
|
|
#endif // C10_UTIL_FBCODEMAPS_H_
|