diff --git a/src/TensorFlowNET.Core/APIs/tf.io.cs b/src/TensorFlowNET.Core/APIs/tf.io.cs index 808b96f2..0ef4d10b 100644 --- a/src/TensorFlowNET.Core/APIs/tf.io.cs +++ b/src/TensorFlowNET.Core/APIs/tf.io.cs @@ -4,7 +4,7 @@ using System.Text; namespace Tensorflow { - public partial class tf + public static partial class tf { public static Tensor read_file(string filename, string name = null) => gen_io_ops.read_file(filename, name); diff --git a/src/TensorFlowNET.Core/Data/DatasetV1.cs b/src/TensorFlowNET.Core/Data/DatasetV1.cs new file mode 100644 index 00000000..b31edace --- /dev/null +++ b/src/TensorFlowNET.Core/Data/DatasetV1.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow.Data +{ + public class DatasetV1 : DatasetV2 + { + } +} diff --git a/src/TensorFlowNET.Core/Data/DatasetV1Adapter.cs b/src/TensorFlowNET.Core/Data/DatasetV1Adapter.cs new file mode 100644 index 00000000..fe5a9b1a --- /dev/null +++ b/src/TensorFlowNET.Core/Data/DatasetV1Adapter.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow.Data +{ + /// + /// Wraps a V2 `Dataset` object in the `tf.compat.v1.data.Dataset` API. + /// + public class DatasetV1Adapter : DatasetV1 + { + } +} diff --git a/src/TensorFlowNET.Core/Data/DatasetV2.cs b/src/TensorFlowNET.Core/Data/DatasetV2.cs new file mode 100644 index 00000000..f49ceb17 --- /dev/null +++ b/src/TensorFlowNET.Core/Data/DatasetV2.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow.Data +{ + /// + /// Represents a potentially large set of elements. + /// + /// A `Dataset` can be used to represent an input pipeline as a + /// collection of elements (nested structures of tensors) and a "logical + /// plan" of transformations that act on those elements. + /// + /// tensorflow\python\data\ops\dataset_ops.py + /// + public class DatasetV2 + { + } +} diff --git a/src/TensorFlowNET.Core/Estimator/EstimatorV2.cs b/src/TensorFlowNET.Core/Estimator/EstimatorV2.cs new file mode 100644 index 00000000..2179cdf7 --- /dev/null +++ b/src/TensorFlowNET.Core/Estimator/EstimatorV2.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Tensorflow.Data; + +namespace Tensorflow.Estimator +{ + /// + /// Estimator class to train and evaluate TensorFlow models. + /// + /// + public class EstimatorV2 : IEstimator + { + public EstimatorV2(string model_dir = null) + { + + } + + /// + /// Calls the input function. + /// + /// + public void call_input_fn(string mode = null) + { + + } + + public void train_model_default(Func input_fn) + { + + } + + public void get_features_and_labels_from_input_fn() + { + + } + } +} diff --git a/src/TensorFlowNET.Core/Estimator/HyperParams.cs b/src/TensorFlowNET.Core/Estimator/HyperParams.cs new file mode 100644 index 00000000..cf1c9c00 --- /dev/null +++ b/src/TensorFlowNET.Core/Estimator/HyperParams.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow.Estimator +{ + public class HyperParams + { + public string data_dir { get; set; } + public string result_dir { get; set; } + public string model_dir { get; set; } + public string eval_dir { get; set; } + + public int dim { get; set; } = 300; + public float dropout { get; set; } = 0.5f; + public int num_oov_buckets { get; set; } = 1; + public int epochs { get; set; } = 25; + public int batch_size { get; set; } = 20; + public int buffer { get; set; } = 15000; + public int lstm_size { get; set; } = 100; + + public string words { get; set; } + public string chars { get; set; } + public string tags { get; set; } + public string glove { get; set; } + } +} diff --git a/src/TensorFlowNET.Core/Estimator/IEstimator.cs b/src/TensorFlowNET.Core/Estimator/IEstimator.cs new file mode 100644 index 00000000..77761960 --- /dev/null +++ b/src/TensorFlowNET.Core/Estimator/IEstimator.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow.Estimator +{ + public interface IEstimator + { + + } +} diff --git a/src/TensorFlowNET.Core/Estimator/README.md b/src/TensorFlowNET.Core/Estimator/README.md new file mode 100644 index 00000000..b39e5650 --- /dev/null +++ b/src/TensorFlowNET.Core/Estimator/README.md @@ -0,0 +1,6 @@ +### TensorFlow Estimator + +TensorFlow Estimator is a high-level TensorFlow API that greatly simplifies machine learning programming. Estimators encapsulate training, evaluation, prediction, and exporting for your model. + +Guide: + diff --git a/src/TensorFlowNET.Core/Estimator/TrainingExecutor.cs b/src/TensorFlowNET.Core/Estimator/TrainingExecutor.cs new file mode 100644 index 00000000..6486ab41 --- /dev/null +++ b/src/TensorFlowNET.Core/Estimator/TrainingExecutor.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow.Estimator +{ + /// + /// The executor to run `Estimator` training and evaluation. + /// + /// + public class TrainingExecutor : Python + { + private IEstimator _estimator; + public TrainingExecutor(IEstimator estimator) + { + _estimator = estimator; + } + } +} diff --git a/test/TensorFlowNET.Examples/Text/NER/BiLstmCrfNer.cs b/test/TensorFlowNET.Examples/Text/NER/BiLstmCrfNer.cs index 19207f6a..c268ec29 100644 --- a/test/TensorFlowNET.Examples/Text/NER/BiLstmCrfNer.cs +++ b/test/TensorFlowNET.Examples/Text/NER/BiLstmCrfNer.cs @@ -13,7 +13,7 @@ namespace TensorFlowNET.Examples /// public class BiLstmCrfNer : IExample { - public int Priority => 13; + public int Priority => 101; public bool Enabled { get; set; } = true; public bool ImportGraph { get; set; } = false; @@ -24,7 +24,7 @@ namespace TensorFlowNET.Examples public bool Run() { PrepareData(); - return true; + return false; } public void PrepareData() diff --git a/test/TensorFlowNET.Examples/Text/NER/CRF.cs b/test/TensorFlowNET.Examples/Text/NER/CRF.cs new file mode 100644 index 00000000..cbe6bb4f --- /dev/null +++ b/test/TensorFlowNET.Examples/Text/NER/CRF.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Tensorflow; + +namespace TensorFlowNET.Examples +{ + /// + /// The CRF module implements a linear-chain CRF layer for learning to predict tag sequences. + /// This variant of the CRF is factored into unary potentials for every element + /// in the sequence and binary potentials for every transition between output tags. + /// + /// tensorflow\contrib\crf\python\ops\crf.py + /// + public class CRF : Python, IExample + { + public int Priority => 13; + + public bool Enabled { get; set; } = true; + public bool ImportGraph { get; set; } = false; + + public string Name => "CRF"; + + public bool Run() + { + return true; + } + + public void PrepareData() + { + + } + } +}