Browse Source

tf.data.Dataset.from_tensor_slices iteration times bug

tags/v0.20
pepure 5 years ago
parent
commit
01e8205f88
1 changed files with 27 additions and 0 deletions
  1. +27
    -0
      test/TensorFlowNET.UnitTest/TF_API/tfdata_test.cs

+ 27
- 0
test/TensorFlowNET.UnitTest/TF_API/tfdata_test.cs View File

@@ -0,0 +1,27 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Tensorflow;
using static Tensorflow.Binding;

namespace TensorFlowNET.UnitTest.TF_API
{
[TestClass]
public class tfdata_test
{
[TestMethod]
public void CreateFromTensor()
{
var X = tf.constant(new[] { 2013, 2014, 2015, 2016, 2017 });
var Y = tf.constant(new[] { 12000, 14000, 15000, 16500, 17500 });

var dataset = tf.data.Dataset.from_tensor_slices(X, Y);
int n = 0;
foreach (var (item_x, item_y) in dataset)
{
print($"x:{item_x.numpy()},y:{item_y.numpy()}");
n += 1;
}
Assert.AreEqual(5, n);
}
}
}

Loading…
Cancel
Save