MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / SetLabel

Method SetLabel

src/io/metadata.cpp:303–319  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

301}
302
303void Metadata::SetLabel(const label_t* label, data_size_t len) {
304 std::lock_guard<std::mutex> lock(mutex_);
305 if (label == nullptr) {
306 Log::Fatal("label cannot be nullptr");
307 }
308
309// bird
310 if (num_data_ != len) {
311 Log::Info("Length of label is not same with #data");
312 }
313 if (!label_.empty()) { label_.clear(); }
314 label_ = std::vector<label_t>(len);
315 #pragma omp parallel for schedule(static)
316 for (data_size_t i = 0; i < len; ++i) {
317 label_[i] = Common::AvoidInf(label[i]);
318 }
319}
320
321void Metadata::SetWeights(const label_t* weights, data_size_t len) {
322 std::lock_guard<std::mutex> lock(mutex_);

Callers 1

SetFloatFieldMethod · 0.45

Calls 3

AvoidInfFunction · 0.50
emptyMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected