예제 #1
0
 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')
예제 #2
0
 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))
예제 #3
0
 def testGetCallableWithKerasModel(self):
     export_path = self.createModelWithMultipleMixedInputs(True)
     model = tf.keras.models.load_model(export_path)
     self.assertEqual(model, model_util.get_callable(model))