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

Method LoadWeights

src/io/metadata.cpp:370–390  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

368}
369
370void Metadata::LoadWeights() {
371 num_weights_ = 0;
372 std::string weight_filename(data_filename_);
373 // default weight file name
374 weight_filename.append(".weight");
375 TextReader<size_t> reader(weight_filename.c_str(), false);
376 reader.ReadAllLines();
377 if (reader.Lines().empty()) {
378 return;
379 }
380 Log::Info("Loading weights...");
381 num_weights_ = static_cast<data_size_t>(reader.Lines().size());
382 weights_ = std::vector<label_t>(num_weights_);
383 #pragma omp parallel for schedule(static)
384 for (data_size_t i = 0; i < num_weights_; ++i) {
385 double tmp_weight = 0.0f;
386 Common::Atof(reader.Lines()[i].c_str(), &tmp_weight);
387 weights_[i] = Common::AvoidInf(static_cast<label_t>(tmp_weight));
388 }
389 weight_load_from_file_ = true;
390}
391
392void Metadata::LoadInitialScore(const char* initscore_file) {
393 num_init_score_ = 0;

Callers

nothing calls this directly

Calls 6

appendMethod · 0.80
AtofFunction · 0.50
AvoidInfFunction · 0.50
ReadAllLinesMethod · 0.45
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected