Skip to content

Commit 5e0e8b1

Browse files
committed
fix iteration times issue.
1 parent 38f9b13 commit 5e0e8b1

File tree

2 files changed

+16
-27
lines changed

2 files changed

+16
-27
lines changed

test/TensorFlowNET.UnitTest/Dataset/DatasetTest.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,21 @@ public void Prefetch()
4545
value += 2;
4646
}
4747
}
48+
49+
[TestMethod]
50+
public void FromTensorSlices()
51+
{
52+
var X = tf.constant(new[] { 2013, 2014, 2015, 2016, 2017 });
53+
var Y = tf.constant(new[] { 12000, 14000, 15000, 16500, 17500 });
54+
55+
var dataset = tf.data.Dataset.from_tensor_slices(X, Y);
56+
int n = 0;
57+
foreach (var (item_x, item_y) in dataset)
58+
{
59+
print($"x:{item_x.numpy()},y:{item_y.numpy()}");
60+
n += 1;
61+
}
62+
Assert.AreEqual(5, n);
63+
}
4864
}
4965
}

test/TensorFlowNET.UnitTest/TF_API/tfdata_test.cs

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)