Skip to content

Commit 2461d2f

Browse files
committed
improve performance 10%
1 parent 694f99c commit 2461d2f

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

test/TensorFlowNET.Examples/LogisticRegression.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ public bool Run()
5353

5454
return with(tf.Session(), sess =>
5555
{
56-
5756
// Run the initializer
5857
sess.run(init);
5958

@@ -71,7 +70,7 @@ public bool Run()
7170
new FeedItem(x, batch_xs),
7271
new FeedItem(y, batch_ys));
7372

74-
var c = (float)result[1];
73+
float c = result[1];
7574
// Compute average loss
7675
avg_cost += c / total_batch;
7776
}

test/TensorFlowNET.Examples/Utility/MnistDataSet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ private static NDArray dense_to_one_hot(NDArray labels_dense, int num_classes)
9696
for(int row = 0; row < num_labels; row++)
9797
{
9898
var col = labels_dense.Data<byte>(row);
99-
labels_one_hot[row, col] = 1;
99+
labels_one_hot.SetData(1, row, col);
100100
}
101101

102102
return labels_one_hot;

0 commit comments

Comments
 (0)