diff --git a/src/TensorFlowNET.Core/Variables/_VariableScopeStore.cs b/src/TensorFlowNET.Core/Variables/_VariableScopeStore.cs index 3f0411a0..0bea062a 100644 --- a/src/TensorFlowNET.Core/Variables/_VariableScopeStore.cs +++ b/src/TensorFlowNET.Core/Variables/_VariableScopeStore.cs @@ -41,7 +41,11 @@ namespace Tensorflow public void close_variable_subscopes(string scope_name) { + var variable_scopes_count_tmp = new Dictionary(); foreach (var k in variable_scopes_count.Keys) + variable_scopes_count_tmp.Add(k, variable_scopes_count[k]); + + foreach (var k in variable_scopes_count_tmp.Keys) if (scope_name == null || k.StartsWith(scope_name + "/")) variable_scopes_count[k] = 0; } diff --git a/test/TensorFlowNET.Examples/ImageProcess/DigitRecognitionCNN.cs b/test/TensorFlowNET.Examples/ImageProcess/DigitRecognitionCNN.cs index a5a70f92..c7a40255 100644 --- a/test/TensorFlowNET.Examples/ImageProcess/DigitRecognitionCNN.cs +++ b/test/TensorFlowNET.Examples/ImageProcess/DigitRecognitionCNN.cs @@ -73,6 +73,8 @@ namespace TensorFlowNET.Examples.ImageProcess float accuracy_test = 0f; float loss_test = 1f; + NDArray x_train; + public bool Run() { PrepareData(); @@ -241,11 +243,19 @@ namespace TensorFlowNET.Examples.ImageProcess public void PrepareData() { mnist = MNIST.read_data_sets("mnist", one_hot: true); + x_train = Reformat(mnist.train.data, mnist.train.labels); print("Size of:"); print($"- Training-set:\t\t{len(mnist.train.data)}"); print($"- Validation-set:\t{len(mnist.validation.data)}"); } + private NDArray Reformat(NDArray x, NDArray y) + { + var (img_size, num_ch, num_class) = (np.sqrt(x.shape[1]), 1, np.unique(np.argmax(y, 1))); + + return x; + } + public void Train(Session sess) { // Number of training iterations in each epoch diff --git a/test/TensorFlowNET.UnitTest/ExamplesTests/ExamplesTest.cs b/test/TensorFlowNET.UnitTest/ExamplesTests/ExamplesTest.cs index 4c71d7e2..9b889359 100644 --- a/test/TensorFlowNET.UnitTest/ExamplesTests/ExamplesTest.cs +++ b/test/TensorFlowNET.UnitTest/ExamplesTests/ExamplesTest.cs @@ -39,6 +39,7 @@ namespace TensorFlowNET.ExamplesTests new InceptionArchGoogLeNet() { Enabled = true }.Run(); } + [Ignore] [TestMethod] public void KMeansClustering() { @@ -83,10 +84,12 @@ namespace TensorFlowNET.ExamplesTests new NearestNeighbor() { Enabled = true, TrainSize = 500, ValidationSize = 100, TestSize = 100 }.Run(); } + [Ignore] [TestMethod] public void WordCnnTextClassification() => new CnnTextClassification { Enabled = true, ModelName = "word_cnn", DataLimit =100 }.Run(); + [Ignore] [TestMethod] public void CharCnnTextClassification() => new CnnTextClassification { Enabled = true, ModelName = "char_cnn", DataLimit = 100 }.Run();