Browse Source

MNST CNN pass.

tags/v0.12
Oceania2018 6 years ago
parent
commit
6d4fc81ffb
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      test/TensorFlowNET.Examples/BasicModels/NaiveBayesClassifier.cs
  2. +1
    -1
      test/TensorFlowNET.Examples/ImageProcessing/DigitRecognitionCNN.cs

+ 1
- 1
test/TensorFlowNET.Examples/BasicModels/NaiveBayesClassifier.cs View File

@@ -62,7 +62,7 @@ namespace TensorFlowNET.Examples


public void fit(NDArray X, NDArray y) public void fit(NDArray X, NDArray y)
{ {
var unique_y = y.unique<int>();
var unique_y = np.unique(y);


var dic = new Dictionary<int, List<List<float>>>(); var dic = new Dictionary<int, List<List<float>>>();
// Init uy in dic // Init uy in dic


+ 1
- 1
test/TensorFlowNET.Examples/ImageProcessing/DigitRecognitionCNN.cs View File

@@ -328,7 +328,7 @@ namespace TensorFlowNET.Examples
/// <returns></returns> /// <returns></returns>
private (NDArray, NDArray) Reformat(NDArray x, NDArray y) private (NDArray, NDArray) Reformat(NDArray x, NDArray y)
{ {
var (img_size, num_ch, num_class) = (np.sqrt(x.shape[1]), 1, len(np.unique<int>(np.argmax(y, 1))));
var (img_size, num_ch, num_class) = (np.sqrt(x.shape[1]).astype(np.int32), 1, len(np.unique(np.argmax(y, 1))));
var dataset = x.reshape(x.shape[0], img_size, img_size, num_ch).astype(np.float32); var dataset = x.reshape(x.shape[0], img_size, img_size, num_ch).astype(np.float32);
//y[0] = np.arange(num_class) == y[0]; //y[0] = np.arange(num_class) == y[0];
//var labels = (np.arange(num_class) == y.reshape(y.shape[0], 1, y.shape[1])).astype(np.float32); //var labels = (np.arange(num_class) == y.reshape(y.shape[0], 1, y.shape[1])).astype(np.float32);


Loading…
Cancel
Save