Browse Source

improve performance 10%

tags/v0.9
Oceania2018 6 years ago
parent
commit
2461d2f461
2 changed files with 2 additions and 3 deletions
  1. +1
    -2
      test/TensorFlowNET.Examples/LogisticRegression.cs
  2. +1
    -1
      test/TensorFlowNET.Examples/Utility/MnistDataSet.cs

+ 1
- 2
test/TensorFlowNET.Examples/LogisticRegression.cs View File

@@ -53,7 +53,6 @@ namespace TensorFlowNET.Examples


return with(tf.Session(), sess => return with(tf.Session(), sess =>
{ {
// Run the initializer // Run the initializer
sess.run(init); sess.run(init);


@@ -71,7 +70,7 @@ namespace TensorFlowNET.Examples
new FeedItem(x, batch_xs), new FeedItem(x, batch_xs),
new FeedItem(y, batch_ys)); new FeedItem(y, batch_ys));


var c = (float)result[1];
float c = result[1];
// Compute average loss // Compute average loss
avg_cost += c / total_batch; avg_cost += c / total_batch;
} }


+ 1
- 1
test/TensorFlowNET.Examples/Utility/MnistDataSet.cs View File

@@ -96,7 +96,7 @@ namespace TensorFlowNET.Examples.Utility
for(int row = 0; row < num_labels; row++) for(int row = 0; row < num_labels; row++)
{ {
var col = labels_dense.Data<byte>(row); var col = labels_dense.Data<byte>(row);
labels_one_hot[row, col] = 1;
labels_one_hot.SetData(1, row, col);
} }


return labels_one_hot; return labels_one_hot;


Loading…
Cancel
Save