[opengm] 259/386: fixed h5 bugs

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Wed Aug 31 08:38:06 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/master
in repository opengm.

commit e6bc1b0444ed5b080b67c41950fbc56f201ecd26
Author: DerThorsten <thorsten.beier at iwr.uni-heidelberg.de>
Date:   Fri Jan 16 13:18:46 2015 +0100

    fixed h5 bugs
---
 include/opengm/learning/dataset/dataset_io.hxx |  8 +++++---
 include/opengm/learning/loss/flexibleloss.hxx  | 19 +++++++++----------
 2 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/include/opengm/learning/dataset/dataset_io.hxx b/include/opengm/learning/dataset/dataset_io.hxx
index 3681d15..e526c09 100644
--- a/include/opengm/learning/dataset/dataset_io.hxx
+++ b/include/opengm/learning/dataset/dataset_io.hxx
@@ -60,12 +60,14 @@ namespace opengm{
             opengm::hdf5::save(gm, ss.str(), "gm");
             hid_t file = marray::hdf5::openFile(ss.str(), marray::hdf5::READ_WRITE);
 
-            marray::Vector<LabelType> mgt(gt.size());
-            std::copy(gt.begin(), gt.end(), mgt.begin());
+            //marray::Vector<LabelType> mgt(gt.size());
+            //std::copy(gt.begin(), gt.end(), mgt.begin());
 
-            marray::hdf5::save(file,"gt",mgt);
+            marray::hdf5::save(file,"gt",gt);
             hid_t lossGrp = marray::hdf5::createGroup(file,"loss");
+
             lossParam.save(lossGrp);
+            marray::hdf5::closeGroup(lossGrp);
             marray::hdf5::closeFile(file);
          }
 
diff --git a/include/opengm/learning/loss/flexibleloss.hxx b/include/opengm/learning/loss/flexibleloss.hxx
index 2301dc2..38f67f4 100644
--- a/include/opengm/learning/loss/flexibleloss.hxx
+++ b/include/opengm/learning/loss/flexibleloss.hxx
@@ -154,29 +154,28 @@ inline void FlexibleLoss::Parameter::load(const hid_t& groupHandle) {
         lossType_ = ConfMat;
     }
 
-    std::cout<<"load nodeLossMultiplier \n";
-
-    if (H5Dopen(groupHandle, "nodeLossMultiplier", H5P_DEFAULT) >= 0) {
+    
+    if (H5Lexists(groupHandle, "nodeLossMultiplier", H5P_DEFAULT)) {
         marray::hdf5::loadVec(groupHandle, "nodeLossMultiplier", this->nodeLossMultiplier_);
     } 
     else {
-        std::cout << "nodeLossMultiplier of FlexibleLoss not found, setting default values" << std::endl;
+        //std::cout << "nodeLossMultiplier of FlexibleLoss not found, setting default values" << std::endl;
     }
 
-    std::cout<<"load factorLossMultiplier \n";
-    if (H5Dopen(groupHandle, "factorLossMultiplier", H5P_DEFAULT) >= 0) {
+    //std::cout<<"load factorLossMultiplier \n";
+    if (H5Lexists(groupHandle, "factorLossMultiplier", H5P_DEFAULT)  ) {
         marray::hdf5::loadVec(groupHandle, "factorLossMultiplier", this->factorMultipier_);
     } 
     else {
-        std::cout << "factorLossMultiplier of FlexibleLoss not found, setting default values" << std::endl;
+        //std::cout << "factorLossMultiplier of FlexibleLoss not found, setting default values" << std::endl;
     }
 
-    std::cout<<"load labelLossMultiplier \n";
-    if (H5Dopen(groupHandle, "labelLossMultiplier", H5P_DEFAULT) >= 0) {
+    //std::cout<<"load labelLossMultiplier \n";
+    if (H5Lexists(groupHandle, "labelLossMultiplier", H5P_DEFAULT) ) {
         marray::hdf5::loadVec(groupHandle, "labelLossMultiplier", this->labelLossMultiplier_);
     } 
     else {
-        std::cout << "labelLossMultiplier of FlexibleLoss not found, setting default values" << std::endl;
+        //std::cout << "labelLossMultiplier of FlexibleLoss not found, setting default values" << std::endl;
     }
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opengm.git



More information about the debian-science-commits mailing list