| 156 | } |
| 157 | |
| 158 | static void writeTensorToHDF5File(const vector<hsize_t> &dimensions, const string &tensor_name, |
| 159 | const string &file_name, Tensor &tensor) |
| 160 | { |
| 161 | H5::H5File h5File(file_name + ".hdf5", H5F_ACC_TRUNC); |
| 162 | H5::DataSpace dataspace(dimensions.size(), &dimensions[0]); |
| 163 | auto dataset = h5File.createDataSet(tensor_name, H5::PredType::IEEE_F32BE, dataspace); |
| 164 | dataset.write(tensor.data(), H5::PredType::NATIVE_FLOAT); |
| 165 | } |
| 166 | |
| 167 | int main(int argc, char *argv[]) |
| 168 | { |