From 4cd985a70811afe6259ba1d2c298472339c75198 Mon Sep 17 00:00:00 2001 From: Oceania2018 Date: Wed, 10 Jul 2019 07:08:10 -0500 Subject: [PATCH] fix _enter_scope_uncached exception when _scope is null. --- src/TensorFlowNET.Core/Variables/variable_scope.py.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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);