@@ -62,12 +62,12 @@ use phloem::Blob;
62
62
/// A Network is usually used together with a [Solver][6] to optimize the networks' weights.
63
63
///
64
64
/// [6]: ../solver/struct.Solver.html
65
- pub struct Network < ' a > {
65
+ pub struct Network {
66
66
/// Identifies the Network
67
67
///
68
68
/// The name is mainly used for logging purposes.
69
69
pub name : String ,
70
- layers : Vec < Layer < ' a > > ,
70
+ layers : Vec < Layer > ,
71
71
layer_names : Vec < String > ,
72
72
layer_names_index : HashMap < String , usize > ,
73
73
layer_need_backwards : Vec < bool > ,
@@ -114,8 +114,8 @@ pub struct Network<'a> {
114
114
weights_weight_decay : Vec < Option < f32 > > ,
115
115
}
116
116
117
- impl < ' a > Default for Network < ' a > {
118
- fn default ( ) -> Network < ' a > {
117
+ impl Default for Network {
118
+ fn default ( ) -> Network {
119
119
Network {
120
120
name : "" . to_owned ( ) ,
121
121
layers : vec ! [ ] ,
@@ -159,7 +159,7 @@ impl<'a> Default for Network<'a> {
159
159
}
160
160
}
161
161
162
- impl < ' a > Network < ' a > {
162
+ impl Network {
163
163
/// Creates a Network from a [NetworkConfig][1].
164
164
/// [1]: ./struct.NetworkConfig.html
165
165
///
@@ -183,12 +183,12 @@ impl<'a> Network<'a> {
183
183
/// to be executed for each blob and layer.
184
184
///
185
185
/// [1]: ./struct.NetworkConfig.html
186
- fn init ( & mut self , in_config : & ' a NetworkConfig ) {
186
+ fn init ( & mut self , in_config : & NetworkConfig ) {
187
187
let config = in_config. clone ( ) ;
188
188
let available_blobs = & mut HashSet :: new ( ) ;
189
189
let blob_name_to_idx = & mut HashMap :: < String , usize > :: new ( ) ;
190
190
for ( input_id, _) in config. inputs . iter ( ) . enumerate ( ) {
191
- self . append_top ( config,
191
+ self . append_top ( & config,
192
192
None ,
193
193
input_id,
194
194
Some ( available_blobs) ,
@@ -198,7 +198,7 @@ impl<'a> Network<'a> {
198
198
self . resize_vecs ( config. layers . len ( ) ) ;
199
199
200
200
for ( layer_id, _) in config. inputs . iter ( ) . enumerate ( ) {
201
- self . init_layer ( layer_id, config, available_blobs, blob_name_to_idx) ;
201
+ self . init_layer ( layer_id, & config, available_blobs, blob_name_to_idx) ;
202
202
}
203
203
204
204
// Go through the net backwards to determine which blobs contribute to the
@@ -259,7 +259,7 @@ impl<'a> Network<'a> {
259
259
/// [4]: ../layers/index.html
260
260
fn init_layer ( & mut self ,
261
261
layer_id : usize ,
262
- config : & ' a NetworkConfig ,
262
+ config : & NetworkConfig ,
263
263
available_blobs : & mut HashSet < String > ,
264
264
blob_name_to_idx : & mut HashMap < String , usize > ) {
265
265
// Caffe
@@ -868,9 +868,19 @@ impl<'a> Network<'a> {
868
868
pub fn learnable_weights ( & self ) -> & Vec < ArcLock < HeapBlob > > {
869
869
& self . learnable_weights
870
870
}
871
+
872
+ #[ allow( missing_docs) ]
873
+ pub fn weights_weight_decay ( & self ) -> & Vec < Option < f32 > > {
874
+ & self . weights_weight_decay
875
+ }
876
+
877
+ #[ allow( missing_docs) ]
878
+ pub fn weights_lr ( & self ) -> & Vec < Option < f32 > > {
879
+ & self . weights_lr
880
+ }
871
881
}
872
882
873
- #[ derive( Debug ) ]
883
+ #[ derive( Debug , Clone ) ]
874
884
/// Defines the configuration of a network.
875
885
///
876
886
/// TODO: [DOC] When and why would you use this?
@@ -959,7 +969,7 @@ impl NetworkConfig {
959
969
}
960
970
}
961
971
962
- #[ derive( Debug ) ]
972
+ #[ derive( Debug , Clone ) ]
963
973
/// Defines the state of a network.
964
974
pub struct NetworkState {
965
975
/// Defines the current mode of the network.
0 commit comments