serizba / cppflow

Run TensorFlow models in C++ without installation and without Bazel
https://serizba.github.io/cppflow/
MIT License
787 stars 178 forks source link

Model Default Operation #72

Closed rustom closed 3 years ago

rustom commented 3 years ago

For my TF2 model, it seems that the default string of the operation used to call the execution of the model is "serving_default_sequential_1_input" instead of "serving_default_input_1". Are these two different versions.

In model.h:

tensor model::operator()(const tensor& input) {
        // The following line runs properly, as opposed to the uncommented line
        // return (*this)({{"serving_default_sequential_1_input", input}}, {"StatefulPartitionedCall"})[0];
        return (*this)({{"serving_default_input_1", input}}, {"StatefulPartitionedCall"})[0];

    }

The line auto output = model(input);, crashes with the current state, but runs for the commented line I inserted above. I can provide more details about my code if necessary.

serizba commented 3 years ago

Hi @rustom-ichhaporia

For all the models that I tried the default input was serving_default_input_1 so I considered it the default one. But as you pointed out, in your model the default input has a different name. You can workaround this problem by using the complex model call.

Nevertheless, I would like to know why your model has a different default name, how did you create your model?

rustom commented 3 years ago

Thanks, I was able to figure it out for my own code, but I was just curious.

I made the model and downloaded it using Google's Teachable Machines.

The output model::get_operations() contains serving_default_sequential_1_input but not serving_default_input_1.