From 22c05f0155e618b58b5d3e9e487883870cee12ac Mon Sep 17 00:00:00 2001 From: Deepak Kumar Date: Fri, 10 Jan 2020 08:25:23 +1030 Subject: [PATCH] Base Layer methods in progress --- src/TensorFlowNET.Keras/IInitializer.cs | 6 - src/TensorFlowNET.Keras/Layers/Layer.cs | 194 +++++++++++++++++++++++- src/TensorFlowNET.Keras/Losses/Loss.cs | 2 +- 3 files changed, 194 insertions(+), 8 deletions(-) delete mode 100644 src/TensorFlowNET.Keras/IInitializer.cs diff --git a/src/TensorFlowNET.Keras/IInitializer.cs b/src/TensorFlowNET.Keras/IInitializer.cs deleted file mode 100644 index d69e0d1b..00000000 --- a/src/TensorFlowNET.Keras/IInitializer.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Keras -{ - interface IInitializer - { - } -} diff --git a/src/TensorFlowNET.Keras/Layers/Layer.cs b/src/TensorFlowNET.Keras/Layers/Layer.cs index 7e23fd71..656e273e 100644 --- a/src/TensorFlowNET.Keras/Layers/Layer.cs +++ b/src/TensorFlowNET.Keras/Layers/Layer.cs @@ -1,14 +1,172 @@ -using System; +using NumSharp; +using System; using System.Collections.Generic; using Tensorflow; using Tensorflow.Keras.Constraints; using Tensorflow.Keras.Initializers; +using Tensorflow.Keras.Losses; using Tensorflow.Keras.Regularizers; namespace Keras.Layers { public abstract class Layer { + public TF_DataType dtype + { + get + { + throw new NotImplementedException(); + } + } + + public string name + { + get + { + throw new NotImplementedException(); + } + } + + public bool stateful + { + get + { + throw new NotImplementedException(); + } + set + { + throw new NotImplementedException(); + } + } + + public bool trainable + { + get + { + throw new NotImplementedException(); + } + } + + public Regularizer activity_regularizer + { + get + { + throw new NotImplementedException(); + } + set + { + throw new NotImplementedException(); + } + } + + public dynamic input_spec + { + get + { + throw new NotImplementedException(); + } + set + { + throw new NotImplementedException(); + } + } + + public Tensor[] trainable_weights + { + get + { + throw new NotImplementedException(); + } + } + + public Tensor[] non_trainable_weights + { + get + { + throw new NotImplementedException(); + } + } + + public Tensor[] weights + { + get + { + throw new NotImplementedException(); + } + } + + public Func[] updates + { + get + { + throw new NotImplementedException(); + } + } + + public Tensor[] losses + { + get + { + throw new NotImplementedException(); + } + } + + public Tensor[] metrics + { + get + { + throw new NotImplementedException(); + } + } + + public Tensor[] input_mask + { + get + { + throw new NotImplementedException(); + } + } + + public Tensor[] output_mask + { + get + { + throw new NotImplementedException(); + } + } + + public Tensor[] input + { + get + { + throw new NotImplementedException(); + } + } + + public Tensor[] output + { + get + { + throw new NotImplementedException(); + } + } + + public TensorShape[] input_shape + { + get + { + throw new NotImplementedException(); + } + } + + public TensorShape[] output_shape + { + get + { + throw new NotImplementedException(); + } + } + public Layer(bool trainable = true, string name = null, string dtype = null, bool @dynamic = false, Dictionary kwargs = null) { @@ -32,5 +190,39 @@ namespace Keras.Layers public TensorShape compute_output_shape(TensorShape input_shape) => throw new NotImplementedException(); public dynamic compute_output_signature(dynamic input_signature) => throw new NotImplementedException(); + + public Tensor[] compute_mask(Tensor[] inputs, Tensor[] mask = null) => throw new NotImplementedException(); + + public void __call__(Tensor[] inputs) => throw new NotImplementedException(); + + public void add_loss(Loss[] losses, Tensor[] inputs = null) => throw new NotImplementedException(); + + public void _clear_losses() => throw new NotImplementedException(); + + public void add_metric(Tensor value, string aggregation= null, string name= null) => throw new NotImplementedException(); + + public void add_update(Func[] updates) => throw new NotImplementedException(); + + public void set_weights(NDArray[] weights) => throw new NotImplementedException(); + + public NDArray[] get_weights() => throw new NotImplementedException(); + + public Func[] get_updates_for(Tensor[] inputs) => throw new NotImplementedException(); + + public Tensor[] get_losses_for(Tensor[] inputs) => throw new NotImplementedException(); + + public Tensor[] get_input_mask_at(int node_index) => throw new NotImplementedException(); + + public Tensor[] get_output_mask_at(int node_index) => throw new NotImplementedException(); + + public TensorShape[] get_input_shape_at(int node_index) => throw new NotImplementedException(); + + public TensorShape[] get_output_shape_at(int node_index) => throw new NotImplementedException(); + + public Tensor[] get_input_at(int node_index) => throw new NotImplementedException(); + + public Tensor[] get_output_at(int node_index) => throw new NotImplementedException(); + + public int count_params() => throw new NotImplementedException(); } } diff --git a/src/TensorFlowNET.Keras/Losses/Loss.cs b/src/TensorFlowNET.Keras/Losses/Loss.cs index 55d9b100..49246027 100644 --- a/src/TensorFlowNET.Keras/Losses/Loss.cs +++ b/src/TensorFlowNET.Keras/Losses/Loss.cs @@ -4,7 +4,7 @@ using System.Text; namespace Tensorflow.Keras.Losses { - class Loss + public abstract class Loss { } }