-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically add KerasInterface to f.
- Loading branch information
1 parent
e5837dc
commit ece36e6
Showing
12 changed files
with
132 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,60 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading; | ||
using Tensorflow.Framework.Models; | ||
using Tensorflow.Keras.Engine; | ||
using Tensorflow.Keras.Layers; | ||
using Tensorflow.Keras.Losses; | ||
using Tensorflow.Keras.Metrics; | ||
using Tensorflow.Keras.Models; | ||
|
||
namespace Tensorflow.Keras | ||
{ | ||
public interface IKerasApi | ||
{ | ||
public ILayersApi layers { get; } | ||
public ILossesApi losses { get; } | ||
public IMetricsApi metrics { get; } | ||
public IInitializersApi initializers { get; } | ||
IInitializersApi initializers { get; } | ||
ILayersApi layers { get; } | ||
ILossesApi losses { get; } | ||
IOptimizerApi optimizers { get; } | ||
IMetricsApi metrics { get; } | ||
IModelsApi models { get; } | ||
|
||
/// <summary> | ||
/// `Model` groups layers into an object with training and inference features. | ||
/// </summary> | ||
/// <param name="input"></param> | ||
/// <param name="output"></param> | ||
/// <returns></returns> | ||
public IModel Model(Tensors inputs, Tensors outputs, string name = null); | ||
IModel Model(Tensors inputs, Tensors outputs, string name = null); | ||
|
||
/// <summary> | ||
/// Instantiate a Keras tensor. | ||
/// </summary> | ||
/// <param name="shape"></param> | ||
/// <param name="batch_size"></param> | ||
/// <param name="dtype"></param> | ||
/// <param name="name"></param> | ||
/// <param name="sparse"> | ||
/// A boolean specifying whether the placeholder to be created is sparse. | ||
/// </param> | ||
/// <param name="ragged"> | ||
/// A boolean specifying whether the placeholder to be created is ragged. | ||
/// </param> | ||
/// <param name="tensor"> | ||
/// Optional existing tensor to wrap into the `Input` layer. | ||
/// If set, the layer will not create a placeholder tensor. | ||
/// </param> | ||
/// <returns></returns> | ||
Tensors Input(Shape shape = null, | ||
int batch_size = -1, | ||
string name = null, | ||
TF_DataType dtype = TF_DataType.DtInvalid, | ||
bool sparse = false, | ||
Tensor tensor = null, | ||
bool ragged = false, | ||
TypeSpec type_spec = null, | ||
Shape batch_input_shape = null, | ||
Shape batch_shape = null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Tensorflow.Keras.Engine; | ||
|
||
namespace Tensorflow.Keras | ||
{ | ||
public interface IOptimizerApi | ||
{ | ||
/// <summary> | ||
/// Adam optimization is a stochastic gradient descent method that is based on | ||
/// adaptive estimation of first-order and second-order moments. | ||
/// </summary> | ||
/// <param name="learning_rate"></param> | ||
/// <param name="beta_1"></param> | ||
/// <param name="beta_2"></param> | ||
/// <param name="epsilon"></param> | ||
/// <param name="amsgrad"></param> | ||
/// <param name="name"></param> | ||
/// <returns></returns> | ||
IOptimizer Adam(float learning_rate = 0.001f, | ||
float beta_1 = 0.9f, | ||
float beta_2 = 0.999f, | ||
float epsilon = 1e-7f, | ||
bool amsgrad = false, | ||
string name = "Adam"); | ||
|
||
/// <summary> | ||
/// Construct a new RMSprop optimizer. | ||
/// </summary> | ||
/// <param name="learning_rate"></param> | ||
/// <param name="rho"></param> | ||
/// <param name="momentum"></param> | ||
/// <param name="epsilon"></param> | ||
/// <param name="centered"></param> | ||
/// <param name="name"></param> | ||
/// <returns></returns> | ||
IOptimizer RMSprop(float learning_rate = 0.001f, | ||
float rho = 0.9f, | ||
float momentum = 0.0f, | ||
float epsilon = 1e-7f, | ||
bool centered = false, | ||
string name = "RMSprop"); | ||
|
||
IOptimizer SGD(float learning_rate); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Tensorflow.Keras.Engine; | ||
|
||
namespace Tensorflow.Keras.Models | ||
{ | ||
public interface IModelsApi | ||
{ | ||
public IModel load_model(string filepath, bool compile = true, LoadOptions? options = null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters