コード例 #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))