Closed DevNullx64 closed 1 year ago
BTW, in the test_step_multi_inputs_function of Model.Evaluate, should train_step be changed to test_step,? can you help change it?
Thank ! It's my mess, I've not well seen this. I'm on it :)
thank @AsakusaRinne to had change pull request title. I will try to take care next. @Wanglongzhi2001, it should be done. But is it a normal behaviour to have "step_train" here ?
Looks good to me.
@DevNullx64 , Seems there exists some bug in the model.evaluate, If the input data is NDArray type, it will matchs both evaluate(Tensor,..) and evaluate(IEnumable
var x_train = np.array(new float[,] { { 0.1f }, { 0.2f }, { 0.3f }, { 0.4f } });
var y_train = np.array(0, 1, 2, 3);
var x_test = x_train;
var y_test = y_train;
var model = keras.Sequential(new List<ILayer>() {
tf.keras.layers.Dense(128, activation: "relu", input_shape: new Shape(1)),
tf.keras.layers.Dense(4)
});
var loss_fn = tf.keras.losses.SparseCategoricalCrossentropy(from_logits: true);
model.compile(optimizer: new Tensorflow.Keras.Optimizers.Adam(),
loss: loss_fn,
metrics: new[] { "accuracy" });
model.fit(x_train, y_train, epochs: 10, verbose: 0);
model.evaluate(x_test, y_test, verbose: 2);
LGTM,Model.Evaluate does have some repetitive code. For example, test_function and test_step_multi_inputs_function are actually doing the same thing, this modification can reduce the repetitive code of overloading.