Caffe
upgrade_proto.hpp
1 #ifndef CAFFE_UTIL_UPGRADE_PROTO_H_
2 #define CAFFE_UTIL_UPGRADE_PROTO_H_
3 
4 #include <string>
5 
6 #include "caffe/proto/caffe.pb.h"
7 
8 namespace caffe {
9 
10 // Return true iff the net is not the current version.
11 bool NetNeedsUpgrade(const NetParameter& net_param);
12 
13 // Check for deprecations and upgrade the NetParameter as needed.
14 bool UpgradeNetAsNeeded(const string& param_file, NetParameter* param);
15 
16 // Read parameters from a file into a NetParameter proto message.
17 void ReadNetParamsFromTextFileOrDie(const string& param_file,
18  NetParameter* param);
19 void ReadNetParamsFromBinaryFileOrDie(const string& param_file,
20  NetParameter* param);
21 
22 // Return true iff any layer contains parameters specified using
23 // deprecated V0LayerParameter.
24 bool NetNeedsV0ToV1Upgrade(const NetParameter& net_param);
25 
26 // Perform all necessary transformations to upgrade a V0NetParameter into a
27 // NetParameter (including upgrading padding layers and LayerParameters).
28 bool UpgradeV0Net(const NetParameter& v0_net_param, NetParameter* net_param);
29 
30 // Upgrade NetParameter with padding layers to pad-aware conv layers.
31 // For any padding layer, remove it and put its pad parameter in any layers
32 // taking its top blob as input.
33 // Error if any of these above layers are not-conv layers.
34 void UpgradeV0PaddingLayers(const NetParameter& param,
35  NetParameter* param_upgraded_pad);
36 
37 // Upgrade a single V0LayerConnection to the V1LayerParameter format.
38 bool UpgradeV0LayerParameter(const V1LayerParameter& v0_layer_connection,
39  V1LayerParameter* layer_param);
40 
41 V1LayerParameter_LayerType UpgradeV0LayerType(const string& type);
42 
43 // Return true iff any layer contains deprecated data transformation parameters.
44 bool NetNeedsDataUpgrade(const NetParameter& net_param);
45 
46 // Perform all necessary transformations to upgrade old transformation fields
47 // into a TransformationParameter.
48 void UpgradeNetDataTransformation(NetParameter* net_param);
49 
50 // Return true iff the Net contains any layers specified as V1LayerParameters.
51 bool NetNeedsV1ToV2Upgrade(const NetParameter& net_param);
52 
53 // Perform all necessary transformations to upgrade a NetParameter with
54 // deprecated V1LayerParameters.
55 bool UpgradeV1Net(const NetParameter& v1_net_param, NetParameter* net_param);
56 
57 bool UpgradeV1LayerParameter(const V1LayerParameter& v1_layer_param,
58  LayerParameter* layer_param);
59 
60 const char* UpgradeV1LayerType(const V1LayerParameter_LayerType type);
61 
62 // Return true iff the Net contains input fields.
63 bool NetNeedsInputUpgrade(const NetParameter& net_param);
64 
65 // Perform all necessary transformations to upgrade input fields into layers.
66 void UpgradeNetInput(NetParameter* net_param);
67 
68 // Return true iff the Net contains batch norm layers with manual local LRs.
69 bool NetNeedsBatchNormUpgrade(const NetParameter& net_param);
70 
71 // Perform all necessary transformations to upgrade batch norm layers.
72 void UpgradeNetBatchNorm(NetParameter* net_param);
73 
74 // Return true iff the solver contains any old solver_type specified as enums
75 bool SolverNeedsTypeUpgrade(const SolverParameter& solver_param);
76 
77 bool UpgradeSolverType(SolverParameter* solver_param);
78 
79 // Check for deprecations and upgrade the SolverParameter as needed.
80 bool UpgradeSolverAsNeeded(const string& param_file, SolverParameter* param);
81 
82 // Read parameters from a file into a SolverParameter proto message.
83 void ReadSolverParamsFromTextFileOrDie(const string& param_file,
84  SolverParameter* param);
85 
86 } // namespace caffe
87 
88 #endif // CAFFE_UTIL_UPGRADE_PROTO_H_
A layer factory that allows one to register layers. During runtime, registered layers can be called b...
Definition: blob.hpp:14