Initialize:
1 | import tensorflow as tf |
2 | import numpy as np |
3 | |
4 | dir = './model/tf_savedmodel' |
5 | zeros = tf.constant(np.zeros([1, 640, 960, 3]), dtype=float) |
Work:
1 | model = tf.saved_model.load(dir) |
2 | output = model.signatures['serving_default'](zeros) |
1 | model = tf.saved_model.load(dir) |
2 | output = model(zeros) |
Failed:
1 | model = tf.saved_model.load(dir).signatures['serving_default'] |
2 | output = model(zeros) |
1 | tensorflow.python.framework.errors_impl.FailedPreconditionError: Error while reading resource variable conv5_block17_0_bn/gamma_96932 from Container: localhost. This could mean that the variable was uninitialized. Not found: Resource localhost/conv5_block17_0_bn/gamma_96932/N10tensorflow3VarE does not exist. |
2 | [[{{node StatefulPartitionedCall/fusion_network/conv5_block17_0_bn/ReadVariableOp}}]] [Op:__inference_signature_wrapper_21102] |
3 | |
4 | Function call stack: |
5 | signature_wrapper |