我想更改保存的模型的输入和输出签名,我使用 tf.Module 对象来构建主模型的操作。
class Generator(tf.Module):
def __init__(....):
super(Generator, self).__init__(name=name)
...
with self.name_scope:
...
@tf.Module.with_name_scope
def __call__(self, input):
...
@tf.function
def serve_function(self, input):
out = self.__call__(input)
return out
call = model.Generator.serve_function.get_concrete_function(tf.TensorSpec([None, 256, 256, 3], tf.float32))
tf.saved_model.save(model.Generator, os.path.join(train_log_dir, 'frozen'))
Run Code Online (Sandbox Code Playgroud)
然后我正在加载模型,但我有“default_serving”和“output_0”作为签名,我该如何更改?
python tensorflow generative-adversarial-network tensorflow2.0