@@ -12,6 +12,77 @@ namespace Tensorflow.Keras.Engine
1212 /// </summary>
1313 public class Layer : CheckpointableBase
1414 {
15+ protected bool trainable ;
16+ protected string _name ;
17+ protected TF_DataType _dtype ;
18+ protected Graph _graph ;
19+ protected string _base_name ;
20+ protected VariableScope _scope ;
21+ /// <summary>
22+ /// A stateful layer is a layer whose updates are run during inference too,
23+ /// for instance stateful RNNs.
24+ /// </summary>
25+ protected bool stateful ;
26+ /// <summary>
27+ /// Indicates whether `build` needs to be called upon layer call, to create
28+ /// the layer's weights.
29+ /// </summary>
30+ protected bool built ;
31+ /// <summary>
32+ /// Provides information about which inputs are compatible with the layer.
33+ /// </summary>
34+ protected InputSpec input_spec ;
35+ protected bool supports_masking ;
1536
37+ public Layer ( bool trainable = true ,
38+ string name = null ,
39+ TF_DataType dtype = TF_DataType . DtInvalid )
40+ {
41+ this . trainable = trainable ;
42+ this . stateful = false ;
43+ this . built = false ;
44+ this . supports_masking = false ;
45+ _init_set_name ( name ) ;
46+ }
47+
48+ public Tensor apply ( Tensor inputs )
49+ {
50+ return __call__ ( inputs ) ;
51+ }
52+
53+ public Tensor __call__ ( Tensor inputs ,
54+ VariableScope scope = null )
55+ {
56+ _set_scope ( scope ) ;
57+ _graph = ops . _get_graph_from_inputs ( new List < Tensor > { inputs } , graph : _graph ) ;
58+ var scope_context_manager = tf . variable_scope ( _scope ) ;
59+
60+ throw new NotImplementedException ( "" ) ;
61+ }
62+
63+ private void _init_set_name ( string name )
64+ {
65+ if ( string . IsNullOrEmpty ( name ) )
66+ ( _name , _base_name ) = _make_unique_name ( ) ;
67+ }
68+
69+ private ( string , string ) _make_unique_name ( )
70+ {
71+ string base_name = "conv2d" ;
72+ string name = base_layer_utils . unique_layer_name ( base_name ) ;
73+ return ( name , base_name ) ;
74+ }
75+
76+ private void _set_scope ( VariableScope scope = null )
77+ {
78+ if ( _scope == null )
79+ {
80+ Python . with ( tf . variable_scope ( scope , default_name : _base_name ) , captured_scope =>
81+ {
82+ _scope = captured_scope ;
83+ } ) ;
84+ }
85+
86+ }
1687 }
1788}
0 commit comments