tensorflow / java

Java bindings for TensorFlow
Apache License 2.0
785 stars 193 forks source link

SavedModelBundle Unable to Load Models with coo_sparse Encoded Input #501

Open james47 opened 10 months ago

james47 commented 10 months ago

Was trying to load a model using SavedModelBundle.load(savedModelPath, "serve") but ran into the operand "" does not exist on the graph issue. Error log:

empty_operand_error_log_censored

Looking into Tensorflow Java source code this error is raised here.

And by inspecting the model being loaded the corresponding input tensor is coo_sparse encoded:

coo_sparse_encoded_censored

It appears to me that when building TensorDescription the library doesn't take coo_sparse encoded format into account: code link: it's trying to fetch the name field which is always empty for coo_sparse encoded format, because together with the name field it's oneof in TensorInfo proto: code link.

Is this a known unsupported feature or would the model loading just work if the validation is bypassed?

Craigacp commented 10 months ago

As we pass in variables by name when functions are called then having something without a name is going to break if you skip the validation (unless you don't use that argument). For outputs it might just about be possible to make it work, I'm not sure if we have a way of dealing with things by position. How do you call this function from TF Python?