MCPcopy Create free account
hub / github.com/DeepGraphLearning/graphvite / SolverMixin

Class SolverMixin

include/core/solver.h:89–888  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87template<size_t _dim, class _Float, class _Index, template<class> class _Graph, template<class> class _Sampler,
88 template<class> class _Worker>
89class SolverMixin {
90public:
91 static const size_t dim = _dim;
92 typedef _Float Float;
93 typedef _Index Index;
94
95 typedef _Graph<Index> Graph;
96 typedef _Sampler<SolverMixin> Sampler;
97 typedef _Worker<SolverMixin> Worker;
98
99 typedef Vector<dim, Float> Vector;
100 typedef typename Sampler::EdgeSample EdgeSample;
101 typedef std::function<void(Sampler *, int, int)> SampleFunction;
102
103 static const int kSampleSize = Sampler::kSampleSize;
104
105 Graph *graph = nullptr;
106 Index num_vertex;
107 size_t num_edge;
108 int num_moment;
109 int num_embedding, num_partition, num_negative, sample_batch_size;
110 float negative_sample_exponent, negative_weight;
111 int num_epoch, episode_size, batch_size, positive_reuse;
112 int log_frequency;
113 bool shuffle_partition, naive_parallel, resume;
114 int assignment_offset;
115 std::vector<std::shared_ptr<std::vector<Vector>>> embeddings;
116 std::vector<std::shared_ptr<std::vector<std::vector<Vector>>>> moments;
117 std::vector<Protocol> protocols;
118 Protocol sampler_protocol;
119 bool tied_weights;
120 std::vector<std::vector<Index>> head_partitions, tail_partitions;
121 Index head_partition_size, tail_partition_size;
122 std::vector<std::pair<int, Index>> head_locations, tail_locations;
123 AliasTable<Float, size_t> edge_table;
124 std::vector<std::vector<std::vector<std::vector<EdgeSample>>>> sample_pools;
125 // <<<<<<<<<<<<<<< predict <<<<<<<<<<<<<<<
126 const std::vector<EdgeSample> *samples;
127 const py::array_t<Index> *array;
128 std::vector<Float> results;
129 std::vector<std::vector<std::vector<EdgeSample>>> predict_pool;
130 std::vector<std::vector<std::vector<size_t>>> sample_indexes;
131 std::vector<std::vector<std::vector<size_t>>> pool_offsets;
132 // >>>>>>>>>>>>>>> predict >>>>>>>>>>>>>>>
133 bool is_train;
134 int pool_id = 0;
135 std::vector<Sampler *> samplers;
136 std::vector<Worker *> workers;
137 std::string model;
138 std::set<std::string> available_models;
139 Optimizer optimizer;
140 int num_worker, num_sampler, num_thread;
141 size_t gpu_memory_limit, gpu_memory_cost;
142 volatile std::atomic<int> batch_id, predict_batch_id;
143 int num_batch, num_predict_batch;
144
145#define USING_SOLVER_MIXIN(type) \
146 using type::dim; \

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected