Browse Source

fix scope name for init_scope().

tags/v0.30
Oceania2018 4 years ago
parent
commit
4359d35850
4 changed files with 6 additions and 8 deletions
  1. +1
    -4
      src/TensorFlowNET.Core/Binding.Util.cs
  2. +1
    -1
      src/TensorFlowNET.Core/Variables/ResourceVariable.cs
  3. +1
    -0
      src/TensorFlowNET.Core/ops.cs
  4. +3
    -3
      src/TensorFlowNET.Core/ops.name_scope.cs

+ 1
- 4
src/TensorFlowNET.Core/Binding.Util.cs View File

@@ -166,7 +166,6 @@ namespace Tensorflow
} }


[DebuggerStepThrough] [DebuggerStepThrough]
[DebuggerNonUserCode()] // with "Just My Code" enabled this lets the debugger break at the origin of the exception
public static void tf_with(ITensorFlowObject py, Action<ITensorFlowObject> action) public static void tf_with(ITensorFlowObject py, Action<ITensorFlowObject> action)
{ {
try try
@@ -181,8 +180,7 @@ namespace Tensorflow
} }
} }


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


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


+ 1
- 1
src/TensorFlowNET.Core/Variables/ResourceVariable.cs View File

@@ -87,9 +87,9 @@ namespace Tensorflow
if (trainable && !collections.Contains(tf.GraphKeys.TRAINABLE_VARIABLES)) if (trainable && !collections.Contains(tf.GraphKeys.TRAINABLE_VARIABLES))
collections.Add(tf.GraphKeys.TRAINABLE_VARIABLES); collections.Add(tf.GraphKeys.TRAINABLE_VARIABLES);


_in_graph_mode = !tf.Context.executing_eagerly();
tf_with(ops.init_scope(), init_scope => tf_with(ops.init_scope(), init_scope =>
{ {
_in_graph_mode = !tf.Context.executing_eagerly();
var values = init_from_fn ? new object[0] : new object[] { initial_value }; var values = init_from_fn ? new object[0] : new object[] { initial_value };
tf_with(ops.name_scope(name, "Variable", values, skip_on_eager: false), scope => tf_with(ops.name_scope(name, "Variable", values, skip_on_eager: false), scope =>
{ {


+ 1
- 0
src/TensorFlowNET.Core/ops.cs View File

@@ -296,6 +296,7 @@ namespace Tensorflow
// outer_device_stack = None // outer_device_stack = None
}); });


tf.Context.ScopeName = scope;
return ops.name_scope(scope); return ops.name_scope(scope);
} }




+ 3
- 3
src/TensorFlowNET.Core/ops.name_scope.cs View File

@@ -48,7 +48,7 @@ namespace Tensorflow
_skip_on_eager = skip_on_eager; _skip_on_eager = skip_on_eager;
} }


// [DebuggerStepThrough]
[DebuggerStepThrough]
public void __enter__() public void __enter__()
{ {
if (tf.Context.executing_eagerly()) if (tf.Context.executing_eagerly())
@@ -96,7 +96,7 @@ namespace Tensorflow
return (scope_name, old_name); return (scope_name, old_name);
} }


[DebuggerHidden]
[DebuggerStepThrough]
public void Dispose() public void Dispose()
{ {
if (tf.Context.executing_eagerly()) if (tf.Context.executing_eagerly())
@@ -105,7 +105,7 @@ namespace Tensorflow
get_default_graph()._name_stack = old_scope_name; get_default_graph()._name_stack = old_scope_name;
} }


[DebuggerNonUserCode]
[DebuggerStepThrough]
public void __exit__() public void __exit__()
{ {
} }


Loading…
Cancel
Save