Browse Source

fix _enter_scope_uncached exception when _scope is null.

tags/v0.10
Oceania2018 6 years ago
parent
commit
4cd985a708
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      src/TensorFlowNET.Core/Variables/variable_scope.py.cs

+ 3
- 3
src/TensorFlowNET.Core/Variables/variable_scope.py.cs View File

@@ -122,13 +122,13 @@ namespace Tensorflow


if (!string.IsNullOrEmpty(_name) || _scope != null) if (!string.IsNullOrEmpty(_name) || _scope != null)
{ {
var name_scope = _scope.name.Split('/').Last();
var name_scope = _scope == null ? _name : _scope.name.Split('/').Last();
if (current_name_scope == null) if (current_name_scope == null)
current_name_scope = ops.name_scope(name_scope); current_name_scope = ops.name_scope(name_scope);
current_name_scope.__enter__(); current_name_scope.__enter__();
var current_name_scope_name = current_name_scope;
string current_name_scope_name = current_name_scope;
_current_name_scope = current_name_scope; _current_name_scope = current_name_scope;
string old_name_scope = _scope.original_name_scope;
string old_name_scope = _scope == null ? current_name_scope_name : _scope.original_name_scope;
if(_scope == null) if(_scope == null)
pure_variable_scope = new PureVariableScope(_name, old_name_scope: old_name_scope); pure_variable_scope = new PureVariableScope(_name, old_name_scope: old_name_scope);


Loading…
Cancel
Save