From 71ea081ea8f0cb25b14eb1b5d3ab404dca2c5a1d Mon Sep 17 00:00:00 2001 From: Oceania2018 Date: Sun, 21 Jun 2020 17:07:15 -0500 Subject: [PATCH] TensorSliceDataset --- src/TensorFlowNET.Core/APIs/c_api.cs | 4 ++-- src/TensorFlowNET.Core/APIs/tf.data.cs | 2 +- src/TensorFlowNET.Core/Data/DatasetManager.cs | 13 +++++++++++++ src/TensorFlowNET.Core/Data/IDatasetV2.cs | 11 +++++++++++ src/TensorFlowNET.Core/Data/TensorSliceDataset.cs | 13 ++++++------- src/TensorFlowNET.Core/TensorFlow.Binding.csproj | 2 +- 6 files changed, 34 insertions(+), 11 deletions(-) create mode 100644 src/TensorFlowNET.Core/Data/DatasetManager.cs create mode 100644 src/TensorFlowNET.Core/Data/IDatasetV2.cs diff --git a/src/TensorFlowNET.Core/APIs/c_api.cs b/src/TensorFlowNET.Core/APIs/c_api.cs index d3dc15ed..69ae3e6d 100644 --- a/src/TensorFlowNET.Core/APIs/c_api.cs +++ b/src/TensorFlowNET.Core/APIs/c_api.cs @@ -1,5 +1,5 @@ /***************************************************************************** - Copyright 2018 The TensorFlow.NET Authors. All Rights Reserved. + Copyright 2020 Haiping Chen. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ namespace Tensorflow /// public partial class c_api { - public const string TensorFlowLibName = "tensorflow"; + public const string TensorFlowLibName = @"D:\SciSharp\tensorflow-google\bazel-bin\tensorflow\tensorflow.dll"; public static string StringPiece(IntPtr handle) { diff --git a/src/TensorFlowNET.Core/APIs/tf.data.cs b/src/TensorFlowNET.Core/APIs/tf.data.cs index 7eee3a90..149ce067 100644 --- a/src/TensorFlowNET.Core/APIs/tf.data.cs +++ b/src/TensorFlowNET.Core/APIs/tf.data.cs @@ -24,7 +24,7 @@ namespace Tensorflow public class DataOps { - public TensorSliceDataset Dataset { get; } = new TensorSliceDataset(); + public DatasetManager Dataset { get; } = new DatasetManager(); } } } diff --git a/src/TensorFlowNET.Core/Data/DatasetManager.cs b/src/TensorFlowNET.Core/Data/DatasetManager.cs new file mode 100644 index 00000000..b46fb791 --- /dev/null +++ b/src/TensorFlowNET.Core/Data/DatasetManager.cs @@ -0,0 +1,13 @@ +using NumSharp; +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow +{ + public class DatasetManager + { + public IDatasetV2 from_tensor_slices(NDArray features, NDArray labels) + => new TensorSliceDataset(features, labels); + } +} diff --git a/src/TensorFlowNET.Core/Data/IDatasetV2.cs b/src/TensorFlowNET.Core/Data/IDatasetV2.cs new file mode 100644 index 00000000..185a3df3 --- /dev/null +++ b/src/TensorFlowNET.Core/Data/IDatasetV2.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow +{ + public interface IDatasetV2 + { + + } +} diff --git a/src/TensorFlowNET.Core/Data/TensorSliceDataset.cs b/src/TensorFlowNET.Core/Data/TensorSliceDataset.cs index 8f6a6dac..65580821 100644 --- a/src/TensorFlowNET.Core/Data/TensorSliceDataset.cs +++ b/src/TensorFlowNET.Core/Data/TensorSliceDataset.cs @@ -5,16 +5,15 @@ using System.Text; namespace Tensorflow { - public class TensorSliceDataset + public class TensorSliceDataset : IDatasetV2 { - public TensorSliceDataset(params NDArray[] elements) - { - - } + NDArray features; + NDArray labels; - public TensorSliceDataset from_tensor_slices(params NDArray[] elements) + public TensorSliceDataset(NDArray features, NDArray labels) { - throw new NotImplementedException(""); + this.features = features; + this.labels = labels; } } } diff --git a/src/TensorFlowNET.Core/TensorFlow.Binding.csproj b/src/TensorFlowNET.Core/TensorFlow.Binding.csproj index 410c62c2..daf75835 100644 --- a/src/TensorFlowNET.Core/TensorFlow.Binding.csproj +++ b/src/TensorFlowNET.Core/TensorFlow.Binding.csproj @@ -5,7 +5,7 @@ TensorFlow.NET Tensorflow 2.2.0 - 0.20.0-preview1 + 0.20.0-preview2 8.0 Haiping Chen, Meinrad Recheis, Eli Belash SciSharp STACK