Open IamSierraCharlie opened 2 years ago
I'm using below alternate solution:
var model = BuildModel();
model.load_weights("");
Thanks for your response. Can you elaborate on "BuildModel()"
Are you using this function? or something like it?
Functional BuildModel()
{
tf.Context.reset_context();
var inputs = keras.Input(shape: 2);
// 1st dense layer
var DenseLayer = keras.layers.Dense(1, activation: keras.activations.Sigmoid);
var outputs = DenseLayer.Apply(inputs);
// build keras model
Functional model = keras.Model(inputs, outputs, name: Guid.NewGuid().ToString());
// show model summary
model.summary();
// compile keras model into tensorflow's static graph
model.compile(loss: keras.losses.MeanSquaredError(name: Guid.NewGuid().ToString()),
optimizer: keras.optimizers.Adam(name: Guid.NewGuid().ToString()),
metrics: new[] { "accuracy" });
return model;
}
Correct.
Thankyou for your direction. I'm just not sure I understand how it works. Are there any other examples or further explanation on how to do this?
Is it just a matter of setting keras.Input(shape: 2)
to be the same shape as what I would input into my own model or is there more to it than that?
I note that when I export my tf built model, I see this warning:
WARNING:tensorflow:Skipping full serialization of Keras layer <keras.layers.core.lambda_layer.Lambda object at 0x7f5c9c357910>, because it is not built. W0124 21:12:34.170078 140039099339136 save_impl.py:71] Skipping full serialization of Keras layer <keras.layers.core.lambda_layer.Lambda object at 0x7f5c9c357910>, because it is not built.
Should I still be able to build / convert my model in this suggested way?
Also, I really would like to know the answer to my first question:
are there plans to implement TF2 functions?
Hello, as per the subject, are there plans to implement TF2 functions?
For example:
This is part of the code I would like to implement in C# from python
Some of this I can do, but now with TF2 being the standard (no frozen inference graph), it is difficult to proceed with building models in the old standard.
Just want to know if there are any plans as I cant find anything in the documentation that matches this use case from python.
Many thanks for your work so far.