@@ -48,6 +48,7 @@ public Layer(bool trainable = true, string name = null, TF_DataType dtype = TF_D
4848 }
4949
5050 public Tensor __call__ ( Tensor inputs ,
51+ Tensor training = null ,
5152 VariableScope scope = null )
5253 {
5354 var input_list = new Tensor [ ] { inputs } ;
@@ -73,7 +74,7 @@ public Tensor __call__(Tensor inputs,
7374 // Symbolic execution on symbolic tensors. We will attempt to build
7475 // the corresponding TF subgraph inside `backend.get_graph()`
7576 var graph = backend . get_graph ( ) ;
76- outputs = call ( inputs ) ;
77+ outputs = call ( inputs , training : training ) ;
7778 _handle_activity_regularization ( inputs , outputs ) ;
7879 _set_mask_metadata ( inputs , outputs , null ) ;
7980 }
@@ -100,7 +101,7 @@ private Tensor compute_mask(Tensor inputs, Tensor mask = null)
100101 return null ;
101102 }
102103
103- protected virtual Tensor call ( Tensor inputs )
104+ protected virtual Tensor call ( Tensor inputs , Tensor training = null )
104105 {
105106 throw new NotImplementedException ( "Layer.call" ) ;
106107 }
@@ -143,13 +144,15 @@ protected virtual RefVariable add_weight(string name,
143144
144145 protected virtual void _init_set_name ( string name )
145146 {
146- if ( string . IsNullOrEmpty ( name ) )
147- ( _name , _base_name ) = _make_unique_name ( ) ;
147+ string base_name = name ;
148+ if ( name == null )
149+ ( _name , base_name ) = _make_unique_name ( ) ;
150+ _base_name = base_name ;
148151 }
149152
150153 protected virtual ( string , string ) _make_unique_name ( )
151154 {
152- string base_name = "conv2d" ;
155+ string base_name = generic_utils . to_snake_case ( this . GetType ( ) . Name ) ;
153156 string name = base_layer_utils . unique_layer_name ( base_name ) ;
154157 return ( name , base_name ) ;
155158 }
0 commit comments