Skip to content

Commit bf53773

Browse files
committed
sync
1 parent 6845233 commit bf53773

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

‎test/TensorFlowNET.Examples/TextProcess/TextClassificationTrain.cs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ protected virtual bool RunWithImportedGraph(Session sess, Graph graph)
5555
{
5656
var stopwatch = Stopwatch.StartNew();
5757
Console.WriteLine("Building dataset...");
58-
var (x, y, alphabet_size) = DataHelpers.build_char_dataset("train", model_name, CHAR_MAX_LEN, DataLimit=null);
58+
var (x, y, alphabet_size) = DataHelpers.build_char_dataset("train", model_name, CHAR_MAX_LEN, DataLimit = null);
5959
Console.WriteLine("\tDONE ");
6060

6161
var (train_x, valid_x, train_y, valid_y) = train_test_split(x, y, test_size: 0.15f);
@@ -169,8 +169,8 @@ protected virtual bool RunWithBuiltGraph(Session session, Graph graph)
169169
//int classes = y.Data<int>().Distinct().Count();
170170
//int samples = len / classes;
171171
int train_size = (int)Math.Round(len * (1 - test_size));
172-
var train_x = x[new Slice(stop:train_size), new Slice()];
173-
var valid_x = x[new Slice(start: train_size+1), new Slice()];
172+
var train_x = x[new Slice(stop: train_size), new Slice()];
173+
var valid_x = x[new Slice(start: train_size + 1), new Slice()];
174174
var train_y = y[new Slice(stop: train_size)];
175175
var valid_y = y[new Slice(start: train_size + 1)];
176176
Console.WriteLine("\tDONE");
@@ -179,7 +179,7 @@ protected virtual bool RunWithBuiltGraph(Session session, Graph graph)
179179

180180
private IEnumerable<(NDArray, NDArray, int)> batch_iter(NDArray inputs, NDArray outputs, int batch_size, int num_epochs)
181181
{
182-
var num_batches_per_epoch = (len(inputs) - 1) / batch_size +1;
182+
var num_batches_per_epoch = (len(inputs) - 1) / batch_size + 1;
183183
var total_batches = num_batches_per_epoch * num_epochs;
184184
foreach (var epoch in range(num_epochs))
185185
{
@@ -189,7 +189,7 @@ protected virtual bool RunWithBuiltGraph(Session session, Graph graph)
189189
var end_index = Math.Min((batch_num + 1) * batch_size, len(inputs));
190190
if (end_index <= start_index)
191191
break;
192-
yield return (inputs[new Slice(start_index, end_index)], outputs[new Slice(start_index,end_index)], total_batches);
192+
yield return (inputs[new Slice(start_index, end_index)], outputs[new Slice(start_index, end_index)], total_batches);
193193
}
194194
}
195195
}

0 commit comments

Comments
 (0)