@@ -27,16 +27,7 @@ public abstract class Trackable
2727 /// Restore-on-create for a variable be saved with this `Checkpointable`.
2828 /// </summary>
2929 /// <returns></returns>
30- protected virtual IVariableV1 _add_variable_with_custom_getter ( string name ,
31- int [ ] shape ,
32- TF_DataType dtype = TF_DataType . TF_FLOAT ,
33- IInitializer initializer = null ,
34- Func < string , int [ ] , TF_DataType , IInitializer , bool , IVariableV1 > getter = null ,
35- bool overwrite = false ,
36- bool trainable = false ,
37- bool use_resource = false ,
38- VariableSynchronization synchronization = VariableSynchronization . Auto ,
39- VariableAggregation aggregation = VariableAggregation . None )
30+ protected virtual IVariableV1 _add_variable_with_custom_getter ( VariableArgs args )
4031 {
4132 ops . init_scope ( ) ;
4233#pragma warning disable CS0219 // Variable is assigned but its value is never used
@@ -50,15 +41,15 @@ protected virtual IVariableV1 _add_variable_with_custom_getter(string name,
5041 checkpoint_initializer = null ;
5142
5243 IVariableV1 new_variable ;
53- new_variable = getter ( name , shape , dtype , initializer , trainable ) ;
44+ new_variable = args . Getter ( args ) ;
5445
5546 // If we set an initializer and the variable processed it, tracking will not
5647 // assign again. It will add this variable to our dependencies, and if there
5748 // is a non-trivial restoration queued, it will handle that. This also
5849 // handles slot variables.
59- if ( ! overwrite || new_variable is RefVariable )
60- return _track_checkpointable ( new_variable , name : name ,
61- overwrite : overwrite ) ;
50+ if ( ! args . Overwrite || new_variable is RefVariable )
51+ return _track_checkpointable ( new_variable , name : args . Name ,
52+ overwrite : args . Overwrite ) ;
6253 else
6354 return new_variable ;
6455 }
0 commit comments