Closed
Description
I'm trying to load a TF2 SavedModel. I'm not sure if I'm doing it right, but I get the same error no matter what I do:
*** Exception: TensorFlowException TF_INVALID_ARGUMENT "Failed to find function \"__inference_signature_wrapper_9381\" in function library: "
I get this using any model I try. Example of a model I tried
import tensorflow as tf
model = tf.keras.applications.MobileNet()
mobilenet_save_path = "mobilenet/1/"
tf.saved_model.save(model, mobilenet_save_path)
I use something like
import "bytestring" Data.ByteString as BS (readFile)
import "proto-lens" Data.ProtoLens (decodeMessageOrDie)
import "vector" Data.Vector.Storable as V
import "tensorflow-proto" Proto.Tensorflow.Core.Protobuf.MetaGraph_Fields (graphDef)
import "tensorflow-proto" Proto.Tensorflow.Core.Protobuf.SavedModel (SavedModel)
import "tensorflow-proto" Proto.Tensorflow.Core.Protobuf.SavedModel_Fields (metaGraphs)
import qualified "tensorflow" TensorFlow.Core as TF
import qualified "tensorflow" TensorFlow.Tensor as TF
test_main :: IO ()
test_main = do
let path = "mobilenet/1/saved_model.pb"
savedModel <- decodeMessageOrDie <$> BS.readFile path :: IO SavedModel
let [metaGraph] = view metaGraphs savedModel
graphDef1 = view graphDef metaGraph
tensor <- TF.runSession $ do
TF.build $ TF.addGraphDef graphDef1
TF.run $ TF.tensorRefFromName "serving_default_input_1" :: TF.Session (V.Vector Double)
print tensor
Help would be much appreciated!
Metadata
Metadata
Assignees
Labels
No labels