Skip to content

Keras saved mode is not .h5 file #19

Description

@xushanthu-2014

Hi I am planning embedding an ML model trained by keras into a climate model which is written by fortran 90. I checked your package and found that it claimed that it is able to translate saved model to fortran script. But I found that my model is not saved by .h5 format, but a folder. I used

def get_model():
    # Create a simple model.
    inputs = keras.Input(shape=(32,))
    outputs = keras.layers.Dense(1)(inputs)
    model = keras.Model(inputs, outputs)
    model.compile(optimizer="adam", loss="mean_squared_error")
    return model


model = get_model()

# Train the model.
test_input = np.random.random((128, 32))
test_target = np.random.random((128, 1))
model.fit(test_input, test_target)

# Calling `save('my_model')` creates a SavedModel folder `my_model`.
model.save("my_model")

# It can be used to reconstruct the model identically.
reconstructed_model = keras.models.load_model("my_model")

so there is a folder named "my_model", and inside there are assets saved_model.pb variables. So can I still use your package? thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions