| 96 | |
| 97 | template <typename T, int32_t D> |
| 98 | void SaveTensorField(dmlc::Stream* strm, const std::string& name, xgboost::DataType type, |
| 99 | const xgboost::linalg::Tensor<T, D>& field) { |
| 100 | strm->Write(name); |
| 101 | strm->Write(static_cast<uint8_t>(type)); |
| 102 | strm->Write(false); // is_scalar=False |
| 103 | for (size_t i = 0; i < D; ++i) { |
| 104 | strm->Write(field.Shape(i)); |
| 105 | } |
| 106 | strm->Write(field.Data()->HostVector()); |
| 107 | } |
| 108 | |
| 109 | template <typename T> |
| 110 | void LoadScalarField(dmlc::Stream* strm, const std::string& expected_name, |
no test coverage detected