@@ -10,18 +10,17 @@ public partial class Model
1010 LossesContainer compiled_loss ;
1111 MetricsContainer compiled_metrics ;
1212
13- public void compile ( IOptimizer optimizer = null ,
14- ILossFunc loss = null ,
15- string [ ] metrics = null )
13+ public void compile ( IOptimizer optimizer ,
14+ ILossFunc loss )
1615 {
1716 this . optimizer = optimizer ?? new RMSprop ( new RMSpropArgs
1817 {
1918 } ) ;
2019
2120 this . loss = loss ?? new MeanSquaredError ( ) ;
2221
23- compiled_loss = new LossesContainer ( loss , output_names : output_names ) ;
24- compiled_metrics = new MetricsContainer ( metrics , output_names : output_names ) ;
22+ compiled_loss = new LossesContainer ( this . loss , output_names : output_names ) ;
23+ compiled_metrics = new MetricsContainer ( new string [ 0 ] , output_names : output_names ) ;
2524
2625 int experimental_steps_per_execution = 1 ;
2726 _configure_steps_per_execution ( experimental_steps_per_execution ) ;
@@ -31,17 +30,17 @@ public void compile(IOptimizer optimizer = null,
3130 _is_compiled = true ;
3231 }
3332
34- public void compile ( IOptimizer optimizer = null ,
35- ILossFunc loss = null ,
36- IMetricFunc [ ] metrics = null )
33+ public void compile ( IOptimizer optimizer ,
34+ ILossFunc loss ,
35+ string [ ] metrics )
3736 {
3837 this . optimizer = optimizer ?? new RMSprop ( new RMSpropArgs
3938 {
4039 } ) ;
4140
4241 this . loss = loss ?? new MeanSquaredError ( ) ;
4342
44- compiled_loss = new LossesContainer ( loss , output_names : output_names ) ;
43+ compiled_loss = new LossesContainer ( this . loss , output_names : output_names ) ;
4544 compiled_metrics = new MetricsContainer ( metrics , output_names : output_names ) ;
4645
4746 int experimental_steps_per_execution = 1 ;
@@ -52,25 +51,58 @@ public void compile(IOptimizer optimizer = null,
5251 _is_compiled = true ;
5352 }
5453
55- public void compile ( string optimizer , string loss , string [ ] metrics )
54+ public void compile ( string optimizer ,
55+ string loss ,
56+ string [ ] metrics )
5657 {
57- var _optimizer = optimizer switch
58+ this . optimizer = optimizer switch
5859 {
5960 "rmsprop" => new RMSprop ( new RMSpropArgs
6061 {
6162
6263 } ) ,
63- _ => throw new NotImplementedException ( "" )
64+ _ => new RMSprop ( new RMSpropArgs
65+ {
66+ } )
6467 } ;
6568
66- ILossFunc _loss = loss switch
69+ this . loss = loss switch
6770 {
6871 "mse" => new MeanSquaredError ( ) ,
6972 "mae" => new MeanAbsoluteError ( ) ,
70- _ => throw new NotImplementedException ( "" )
73+ _ => new MeanSquaredError ( )
7174 } ;
7275
73- compile ( optimizer : _optimizer , loss : _loss , metrics : metrics ) ;
76+ compiled_loss = new LossesContainer ( this . loss , output_names : output_names ) ;
77+ compiled_metrics = new MetricsContainer ( metrics , output_names : output_names ) ;
78+
79+ int experimental_steps_per_execution = 1 ;
80+ _configure_steps_per_execution ( experimental_steps_per_execution ) ;
81+
82+ // Initialize cache attrs.
83+ _reset_compile_cache ( ) ;
84+ _is_compiled = true ;
85+ }
86+
87+ public void compile ( IOptimizer optimizer ,
88+ ILossFunc loss ,
89+ IMetricFunc [ ] metrics )
90+ {
91+ this . optimizer = optimizer ?? new RMSprop ( new RMSpropArgs
92+ {
93+ } ) ;
94+
95+ this . loss = loss ?? new MeanSquaredError ( ) ;
96+
97+ compiled_loss = new LossesContainer ( this . loss , output_names : output_names ) ;
98+ compiled_metrics = new MetricsContainer ( metrics , output_names : output_names ) ;
99+
100+ int experimental_steps_per_execution = 1 ;
101+ _configure_steps_per_execution ( experimental_steps_per_execution ) ;
102+
103+ // Initialize cache attrs.
104+ _reset_compile_cache ( ) ;
105+ _is_compiled = true ;
74106 }
75107 }
76108}
0 commit comments