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]
[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)
{
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
{
try
@@ -198,7 +196,6 @@ namespace Tensorflow
}

[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
{
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))
collections.Add(tf.GraphKeys.TRAINABLE_VARIABLES);

_in_graph_mode = !tf.Context.executing_eagerly();
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 };
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
});

tf.Context.ScopeName = 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;
}

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

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

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


Loading…
Cancel
Save