Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Input Models #19

Open
gan3sh500 opened this issue Feb 20, 2021 · 0 comments
Open

Multiple Input Models #19

gan3sh500 opened this issue Feb 20, 2021 · 0 comments

Comments

@gan3sh500
Copy link

gan3sh500 commented Feb 20, 2021

Thank you so much for this repo. When using models with multiple models this code will fail obviously. Here is how to do it for multiple inputs. Wasn't sure where to PR so just opening this issue to help others trying the same.

full_model = tf.function(lambda x: model(x))
get_concrete_func_x = []
for i in range(len(model.inputs)):
    get_concrete_func_x.append(
        tf.TensorSpec(
            model.inputs[i].shape,
            model.inputs[i].dtype,
            name=model.inputs[i].name
        )
    )
# basically x should be a TensorSpec or tuple of them.
# don't put a generator directly or it will fail too.
get_concrete_func_x = tuple(get_concrete_func_x)
full_model = full_model.get_concrete_function(x=get_concrete_func_x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant