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

Method gather

include/base/memory.h:194–205  ·  view source on GitHub ↗

Gather data from a pool according to an index mapping. Automatically resize the memory when necessary. */

Source from the content-addressed store, hash-verified

192
193 /** Gather data from a pool according to an index mapping. Automatically resize the memory when necessary. */
194 void gather(const std::vector<Data> &memory, const std::vector<Index> &mapping) {
195 if (!mapping.empty()) {
196 resize(mapping.size());
197 for (Index i = 0; i < count; i++)
198 host_ptr[i] = memory[mapping[i]];
199 }
200 else {
201 resize(memory.size());
202 for (Index i = 0; i < count; i++)
203 host_ptr[i] = memory[i];
204 }
205 }
206
207 /** Scatter data to a pool according to an index mapping */
208 void scatter(std::vector<Data> &memory, const std::vector<Index> &mapping) {

Callers 2

linear_classificationFunction · 0.80
load_embeddingMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected