Skip to content

Commit 4359d35

Browse files
committed
fix scope name for init_scope().
1 parent 8b9fca4 commit 4359d35

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

src/TensorFlowNET.Core/Binding.Util.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ public static IEnumerable<int> range(int start, int end)
166166
}
167167

168168
[DebuggerStepThrough]
169-
[DebuggerNonUserCode()] // with "Just My Code" enabled this lets the debugger break at the origin of the exception
170169
public static void tf_with(ITensorFlowObject py, Action<ITensorFlowObject> action)
171170
{
172171
try
@@ -181,8 +180,7 @@ public static void tf_with(ITensorFlowObject py, Action<ITensorFlowObject> actio
181180
}
182181
}
183182

184-
[DebuggerStepThrough]
185-
[DebuggerNonUserCode()] // with "Just My Code" enabled this lets the debugger break at the origin of the exception
183+
// [DebuggerStepThrough]
186184
public static void tf_with<T>(T py, Action<T> action) where T : ITensorFlowObject
187185
{
188186
try
@@ -198,7 +196,6 @@ public static void tf_with<T>(T py, Action<T> action) where T : ITensorFlowObjec
198196
}
199197

200198
[DebuggerStepThrough]
201-
[DebuggerNonUserCode()] // with "Just My Code" enabled this lets the debugger break at the origin of the exception
202199
public static TOut tf_with<TIn, TOut>(TIn py, Func<TIn, TOut> action) where TIn : ITensorFlowObject
203200
{
204201
try

src/TensorFlowNET.Core/Variables/ResourceVariable.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ private void _init_from_args(object initial_value = null,
8787
if (trainable && !collections.Contains(tf.GraphKeys.TRAINABLE_VARIABLES))
8888
collections.Add(tf.GraphKeys.TRAINABLE_VARIABLES);
8989

90-
_in_graph_mode = !tf.Context.executing_eagerly();
9190
tf_with(ops.init_scope(), init_scope =>
9291
{
92+
_in_graph_mode = !tf.Context.executing_eagerly();
9393
var values = init_from_fn ? new object[0] : new object[] { initial_value };
9494
tf_with(ops.name_scope(name, "Variable", values, skip_on_eager: false), scope =>
9595
{

src/TensorFlowNET.Core/ops.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ public static NameScope init_scope()
296296
// outer_device_stack = None
297297
});
298298

299+
tf.Context.ScopeName = scope;
299300
return ops.name_scope(scope);
300301
}
301302

src/TensorFlowNET.Core/ops.name_scope.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public NameScope(string name, string default_name = "", object values = null, bo
4848
_skip_on_eager = skip_on_eager;
4949
}
5050

51-
// [DebuggerStepThrough]
51+
[DebuggerStepThrough]
5252
public void __enter__()
5353
{
5454
if (tf.Context.executing_eagerly())
@@ -96,7 +96,7 @@ public void __enter__()
9696
return (scope_name, old_name);
9797
}
9898

99-
[DebuggerHidden]
99+
[DebuggerStepThrough]
100100
public void Dispose()
101101
{
102102
if (tf.Context.executing_eagerly())
@@ -105,7 +105,7 @@ public void Dispose()
105105
get_default_graph()._name_stack = old_scope_name;
106106
}
107107

108-
[DebuggerNonUserCode]
108+
[DebuggerStepThrough]
109109
public void __exit__()
110110
{
111111
}

0 commit comments

Comments
 (0)