From 29df64b95b07810317e307ff102e5f901a36e9a3 Mon Sep 17 00:00:00 2001 From: Vladimir Plazun/Engineer/AI Tools Lab /SRR/Samsung Electronics Date: Thu, 31 Oct 2019 07:24:29 +0300 Subject: [PATCH] [nnpkg_run] Fix hdf5 file dump (#8575) Value group have to be created only once for file Remove blank line Signed-off-by: Vladimir Plazun --- tests/tools/nnpackage_run/src/nnpackage_run.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/tools/nnpackage_run/src/nnpackage_run.cc b/tests/tools/nnpackage_run/src/nnpackage_run.cc index 254ef55..fb390ad 100644 --- a/tests/tools/nnpackage_run/src/nnpackage_run.cc +++ b/tests/tools/nnpackage_run/src/nnpackage_run.cc @@ -229,6 +229,7 @@ int main(const int argc, char **argv) auto dumpOutputs = [session, num_outputs, &outputs](std::string filename) { hid_t file_id = H5Fcreate(filename.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + hid_t valgrp_id = H5Gcreate(file_id, h5_value_grpname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); for (uint32_t i = 0; i < num_outputs; i++) { nnfw_tensorinfo ti; @@ -240,14 +241,14 @@ int main(const int argc, char **argv) assert(ti.dims[j] >= 0); dims[j] = ti.dims[j]; } - hid_t valgrp_id = H5Gcreate(file_id, h5_value_grpname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - hid_t dsp_id = H5Screate_simple(ti.rank, dims.data(), NULL); + hid_t dsp_id = H5Screate_simple(ti.rank, dims.data(), nullptr); hid_t dset_id = H5Dcreate2(valgrp_id, std::to_string(i).c_str(), H5T_IEEE_F32BE, dsp_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); H5Dwrite(dset_id, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, outputs[i].data()); H5Dclose(dset_id); H5Sclose(dsp_id); } + H5Gclose(valgrp_id); H5Fclose(file_id); }; -- 2.7.4