SciSharp/TensorFlow.NET

Tensorflow.ValueError: Cannot deserialize 'null' to `Axis`.

Closed this issue · 0 comments

Description

please help me.

I tried to reload the model using normalization to build and export it, but got this error: Tensorflow ValueError: Cannot deserialize 'null' to Axis.

Is Axis necessary to configure, but according to your tutorial, it has not been configured either. Source: TensorFlowNET.Examples.FuelEfficiencyPrediction

critical code:
var normalizer = keras.layers.Normalization(input_shape: 1, axis: null);
normalizer.adapt(features);

    var model = keras.Sequential(normalizer,
        keras.layers.Dense(units: 1));

    model.compile(
        optimizer: keras.optimizers.SGD(learning_rate: 0.01f),
        loss: keras.losses.MeanSquaredError(),
        metrics: ["accuracy"]
    );

model.save(modelPath);

var model = tf.keras.models.load_model(modelPath); -- throw exception