Browse Source

fix iteration times issue.

tags/v0.20
Oceania2018 5 years ago
parent
commit
5e0e8b1b95
2 changed files with 16 additions and 27 deletions
  1. +16
    -0
      test/TensorFlowNET.UnitTest/Dataset/DatasetTest.cs
  2. +0
    -27
      test/TensorFlowNET.UnitTest/TF_API/tfdata_test.cs

+ 16
- 0
test/TensorFlowNET.UnitTest/Dataset/DatasetTest.cs View File

@@ -45,5 +45,21 @@ namespace TensorFlowNET.UnitTest.Dataset
value += 2;
}
}

[TestMethod]
public void FromTensorSlices()
{
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);
}
}
}

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

@@ -1,27 +0,0 @@
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