diff --git a/src/TensorFlowNET.Core/Variables/variable_scope.py.cs b/src/TensorFlowNET.Core/Variables/variable_scope.py.cs index a542dc56..11bc7d3d 100644 --- a/src/TensorFlowNET.Core/Variables/variable_scope.py.cs +++ b/src/TensorFlowNET.Core/Variables/variable_scope.py.cs @@ -122,13 +122,13 @@ namespace Tensorflow 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) current_name_scope = ops.name_scope(name_scope); 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; - 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) pure_variable_scope = new PureVariableScope(_name, old_name_scope: old_name_scope);