[nnpkg-run] allow --load to accept little endian (#8116)
author이상규/On-Device Lab(SR)/Principal Engineer/삼성전자 <sg5.lee@samsung.com>
Tue, 15 Oct 2019 01:17:18 +0000 (10:17 +0900)
committer이춘석/On-Device Lab(SR)/Staff Engineer/삼성전자 <chunseok.lee@samsung.com>
Tue, 15 Oct 2019 01:17:18 +0000 (10:17 +0900)
It will allow little endianness in `nnpackage-run`.
`hdf5` internally convert endianness if necessay.
All we need is to allow little endian from if-condition.

Signed-off-by: Sanggyu Lee <sg5.lee@samsung.com>
tests/tools/nnpackage_run/src/nnpackage_run.cc

index 3e849cd..68c2e7f 100644 (file)
@@ -161,7 +161,7 @@ int main(const int argc, char **argv)
 
       // check type
       hid_t type = H5Dget_type(dset_id);
-      if (!H5Tequal(type, H5T_IEEE_F32BE))
+      if (!H5Tequal(type, H5T_IEEE_F32BE) && !H5Tequal(type, H5T_IEEE_F32LE))
       {
         std::cerr << "h5 input has non-float32 type. nnpkg_run supports float32 only." << std::endl;
         H5Dclose(dset_id);
@@ -169,6 +169,7 @@ int main(const int argc, char **argv)
         H5Fclose(file_id);
         exit(-1);
       }
+
       // allocate memory for data
       auto sz = num_elems(&ti);
       inputs[i].resize(sz);