add support for hdf5 output layer
authorJeff Donahue <jeff.donahue@gmail.com>
Thu, 27 Mar 2014 22:11:22 +0000 (15:11 -0700)
committerJeff Donahue <jeff.donahue@gmail.com>
Fri, 28 Mar 2014 06:42:29 +0000 (23:42 -0700)
src/caffe/test/test_upgrade_proto.cpp
src/caffe/util/upgrade_proto.cpp

index e5a9478..323a8ae 100644 (file)
@@ -1472,6 +1472,15 @@ TYPED_TEST(V0UpgradeTest, TestAllParams) {
       "} "
       "layers { "
       "  layer { "
+      "    name: 'hdf5_output' "
+      "    type: 'hdf5_output' "
+      "    hdf5_output_param { "
+      "      file_name: '/my/hdf5/output/file' "
+      "    } "
+      "  } "
+      "} "
+      "layers { "
+      "  layer { "
       "    name: 'im2col' "
       "    type: 'im2col' "
       "  } "
@@ -1710,6 +1719,13 @@ TYPED_TEST(V0UpgradeTest, TestAllParams) {
       "  type: FLATTEN "
       "} "
       "layers { "
+      "  name: 'hdf5_output' "
+      "  type: HDF5_OUTPUT "
+      "  hdf5_output_param { "
+      "    file_name: '/my/hdf5/output/file' "
+      "  } "
+      "} "
+      "layers { "
       "  name: 'im2col' "
       "  type: IM2COL "
       "} "
index 8c7934e..0371d76 100644 (file)
@@ -476,6 +476,16 @@ bool UpgradeLayerParameter(const LayerParameter& v0_layer_connection,
         is_fully_compatible = false;
       }
     }
+    if (v0_layer_param.has_hdf5_output_param()) {
+      if (type == "hdf5_output") {
+        layer_param->mutable_hdf5_output_param()->CopyFrom(
+            v0_layer_param.hdf5_output_param());
+      } else {
+        LOG(ERROR) << "Unknown parameter hdf5_output_param for layer type "
+                   << type;
+        is_fully_compatible = false;
+      }
+    }
   }
   return is_fully_compatible;
 }
@@ -499,6 +509,8 @@ LayerParameter_LayerType UpgradeV0LayerType(const string& type) {
     return LayerParameter_LayerType_FLATTEN;
   } else if (type == "hdf5_data") {
     return LayerParameter_LayerType_HDF5_DATA;
+  } else if (type == "hdf5_output") {
+    return LayerParameter_LayerType_HDF5_OUTPUT;
   } else if (type == "im2col") {
     return LayerParameter_LayerType_IM2COL;
   } else if (type == "images") {