Skip to content

libc++abi: terminating with uncaught exception of type std::runtime_error: No operation named "serving_default_input_1" exists #211

@garricklw

Description

@garricklw

I'd like to document an issue I ran into and the resolution in case anyone else runs into it, and to propose an api improvement, if possible, that would make the issue less difficult in the future.

I got the above error while trying to load a Keras model, and the resolution was that I needed to make sure the first layer of my model was named "input_1".

Keras has a singleton-esque pattern for naming its layers. That is, each time a layer of the same type is initialized in the same runtime, it increments the counter of the layer name. So the first time you create an input it's "input_1", the second time it's "input_2", etc...

This makes it really easy to make a model that throws the above error and not know exactly why it's happening. If it's possible, why not inspect the layers of the Keras model in cpp and use the first input layer as input by default, rather than looking for a hard-coded default name?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions