Dragon - C++ API
A Computation Graph Virtual Machine Based Deep Learning Framework
common.h
Go to the documentation of this file.
1 
13 #ifndef DRAGON_CORE_COMMON_H_
14 #define DRAGON_CORE_COMMON_H_
15 
16 #include <ctime>
17 #include <cmath>
18 #include <climits>
19 #include <float.h>
20 #include <random>
21 #include <numeric>
22 #include <memory>
23 #include <string>
24 #include <queue>
25 #include <stack>
26 #include <array>
27 #include <vector>
28 #include <set>
29 #include <map>
30 #include <unordered_map>
31 #include <unordered_set>
32 #include <algorithm>
33 #include <mutex>
34 #include <functional>
35 
36 #include "core/types.h"
37 #include "proto/dragon.pb.h"
38 #include "utils/string.h"
39 #include "utils/logging.h"
40 
41 namespace dragon {
42 
43 using std::string;
44 using std::queue;
45 using std::stack;
46 using std::vector;
47 using std::pair;
48 using std::set;
49 using std::map;
50 using std::unique_ptr;
51 using std::shared_ptr;
52 
53 template <typename Key, typename Value>
54 using Map = std::unordered_map<Key, Value>;
55 
56 template <typename Value>
57 using Set = std::unordered_set<Value>;
58 
59 /* * * * * * * * * * * * * * * * * * * * *
60  * *
61  * Kernel Version *
62  * *
63  * Major(3) | Minor(0) | Patch(00) *
64  * *
65  * * * * * * * * * * * * * * * * * * * * */
66 
67 #define DRAGON_VERSION 3000
68 
69 /* * * * * * * * * * * * * * * * * * * * *
70  * *
71  * Default Random Seed *
72  * *
73  * * * * * * * * * * * * * * * * * * * * */
74 
75 #define DEFAULT_RNG_SEED 3
76 
77 /* * * * * * * * * * * * * * * * * * * * *
78  * *
79  * Macros *
80  * *
81  * * * * * * * * * * * * * * * * * * * * */
82 
83 // Avoid using of "thread_local" for VS2013 or older Xcode
84 #if defined(__clang__) || defined(__GNUC__)
85 #define TLS_OBJECT __thread
86 #else
87 #define TLS_OBJECT __declspec(thread)
88 #endif
89 
90 #define CONCATENATE_IMPL(s1, s2) s1##s2
91 #define CONCATENATE(s1, s2) CONCATENATE_IMPL(s1,s2)
92 #define ANONYMOUS_VARIABLE(str) CONCATENATE(str, __LINE__)
93 #define NOT_IMPLEMENTED LOG(FATAL) << "This module has not been implemented yet."
94 
95 } // namespace dragon
96 
97 #endif // DRAGON_CORE_COMMON_H_
std::unordered_map< Key, Value > Map
Definition: common.h:54
std::unordered_set< Value > Set
Definition: common.h:57
Definition: common.h:41