| 584 | } |
| 585 | |
| 586 | bool Dataset::GetFloatField(const char* field_name, data_size_t* out_len, const float** out_ptr) { |
| 587 | std::string name(field_name); |
| 588 | name = Common::Trim(name); |
| 589 | if (name == std::string("label") || name == std::string("target")) { |
| 590 | #ifdef LABEL_T_USE_DOUBLE |
| 591 | Log::Fatal("Don't support LABEL_T_USE_DOUBLE"); |
| 592 | #else |
| 593 | *out_ptr = metadata_.label(); |
| 594 | *out_len = metadata_.label_.size(); |
| 595 | #endif |
| 596 | } else if (name == std::string("weight") || name == std::string("weights")) { |
| 597 | #ifdef LABEL_T_USE_DOUBLE |
| 598 | Log::Fatal("Don't support LABEL_T_USE_DOUBLE"); |
| 599 | #else |
| 600 | *out_ptr = metadata_.weights(); |
| 601 | *out_len = metadata_.weights_.size(); |
| 602 | #endif |
| 603 | } else { |
| 604 | return false; |
| 605 | } |
| 606 | return true; |
| 607 | } |
| 608 | |
| 609 | bool Dataset::GetDoubleField(const char* field_name, data_size_t* out_len, const double** out_ptr) { |
| 610 | std::string name(field_name); |
no test coverage detected