@@ -119,7 +119,7 @@ Variable MakeVariable (TFOutput initialValue, bool trainable, string operName)
119119
120120 using ( var newScope = WithScope ( scopeName ) ) {
121121 var type = initialValue . OutputType ;
122- var variableHandle = VarHandleOp ( type , new TFShape ( GetShape ( initialValue ) ) ) ;
122+ var variableHandle = VarHandleOp ( type , new TFShape ( GetShape ( initialValue ) ) , shared_name : operName ) ;
123123 using ( var aScope = WithScope ( "Assign" ) ) {
124124 var assignOp = AssignVariableOp ( variableHandle , initialValue ) ;
125125 using ( var rScope = WithScope ( "Read" ) ) {
@@ -208,22 +208,22 @@ public TFOperation [] GetGlobalVariablesInitializer ()
208208 return res ;
209209 }
210210
211- /// <summary>
212- /// Variable node, with a starting initial value. Convenience that registers the init variable to a global queue.
213- /// </summary>
214- /// <param name="initialValue">Initial value.</param>
215- /// <param name="value">Returns the value of the variable.</param>
216- /// <param name="trainable">If true, this add the variable to the graph's TrainableVariables, this collection is intended to be used by the Optimizer classes.</param>
217- /// <param name="operName">Operation name, optional.</param>
218- /// <returns>The returning Variable contains the variable, with three nodes with the operations making up the variable assignment.</returns>
219- /// <remarks>
220- /// Variables need to be initialized before the main execution so you will typically want to
221- /// run the session on the variable.
222- ///
223- /// The init sequence for the variable is stored in the graph, you must manually initialize
224- /// those by running the session on the global variables.
225- /// </remarks>
226- public Variable Variable ( TFOutput initialValue , out TFOutput value , bool trainable = true , string operName = null )
211+ /// <summary>
212+ /// Variable node, with a starting initial value. Convenience that registers the init variable to a global queue.
213+ /// </summary>
214+ /// <param name="initialValue">Initial value.</param>
215+ /// <param name="value">Returns the value of the variable.</param>
216+ /// <param name="trainable">If true, this add the variable to the graph's TrainableVariables, this collection is intended to be used by the Optimizer classes.</param>
217+ /// <param name="operName">Operation name, optional.</param>
218+ /// <returns>The returning Variable contains the variable, with three nodes with the operations making up the variable assignment.</returns>
219+ /// <remarks>
220+ /// Variables need to be initialized before the main execution so you will typically want to
221+ /// run the session on the variable.
222+ ///
223+ /// The init sequence for the variable is stored in the graph, you must manually initialize
224+ /// those by running the session on the global variables.
225+ /// </remarks>
226+ public Variable Variable ( TFOutput initialValue , out TFOutput value , bool trainable = true , string operName = null )
227227 {
228228 var nv = MakeVariable ( initialValue , trainable , operName ) ;
229229 value = nv . Read ;
0 commit comments