Skip to content

Commit 02ad55f

Browse files
committed
change num_steps to 10000 for XOR neural netwrok example.
1 parent ffebb85 commit 02ad55f

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

‎test/TensorFlowNET.Examples/NeuralNetXor.cs‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class NeuralNetXor : Python, IExample
1818
public string Name => "NN XOR";
1919
public bool ImportGraph { get; set; } = false;
2020

21-
public int num_steps = 5000;
21+
public int num_steps = 10000;
2222

2323
private NDArray data;
2424

@@ -55,7 +55,7 @@ public bool Run()
5555
if (ImportGraph)
5656
loss_value = RunWithImportedGraph();
5757
else
58-
loss_value=RunWithBuiltGraph();
58+
loss_value = RunWithBuiltGraph();
5959

6060
return loss_value < 0.0628;
6161
}
@@ -96,6 +96,7 @@ private float RunWithImportedGraph()
9696
}
9797
Console.WriteLine($"Final loss: {loss_value}");
9898
});
99+
99100
return loss_value;
100101
}
101102

@@ -120,11 +121,6 @@ private float RunWithBuiltGraph()
120121
var y_ = np.array(new int[] { 1, 0, 0, 1 }, dtype: np.int32);
121122
while (step < num_steps)
122123
{
123-
// original python:
124-
//_, step, loss_value = sess.run(
125-
// [train_op, gs, loss],
126-
// feed_dict={features: xy, labels: y_}
127-
// )
128124
var result = sess.run(new ITensorOrOperation[] { train_op, gs, loss }, new FeedItem(features, data), new FeedItem(labels, y_));
129125
loss_value = result[2];
130126
//step = result[1];
@@ -134,6 +130,7 @@ private float RunWithBuiltGraph()
134130
}
135131
Console.WriteLine($"Final loss: {loss_value}");
136132
});
133+
137134
return loss_value;
138135
}
139136

0 commit comments

Comments
 (0)