def testGetInputSpecsWithMissingSignatures(self, save_as_keras): export_path = self.createModelWithSingleInput(save_as_keras) if save_as_keras: model = tf.keras.models.load_model(export_path) else: model = tf.compat.v1.saved_model.load_v2(export_path) with self.assertRaises(ValueError): model_util.get_callable(model, 'non_existent')
def testGetCallableWithSignatures(self, save_as_keras, signature_name): export_path = self.createModelWithSingleInput(save_as_keras) if save_as_keras: model = tf.keras.models.load_model(export_path) else: model = tf.compat.v1.saved_model.load_v2(export_path) self.assertIsNotNone(model_util.get_callable(model, signature_name))
def testGetCallableWithKerasModel(self): export_path = self.createModelWithMultipleMixedInputs(True) model = tf.keras.models.load_model(export_path) self.assertEqual(model, model_util.get_callable(model))