# pylint:disable=g-import-not-at-top,g-statement-before-imports try: import mock as mock except ImportError: import unittest.mock as mock # pylint:disable=g-import-not-at-top,g-statement-before-imports from absl.testing import parameterized import tensorflow as tf from tensorflow_hub import config from tensorflow_hub import module_v2 from tensorflow_hub import test_utils # Initialize resolvers and loaders. config._run() class ModuleV2Test(tf.test.TestCase, parameterized.TestCase): @parameterized.named_parameters( ('v1_implicit_tags', 'hub_module_v1_mini', None, True), ('v1_explicit_tags', 'hub_module_v1_mini', [], True), ('v2_implicit_tags', 'saved_model_v2_mini', None, False), ('v2_explicit_tags', 'saved_model_v2_mini', ['serve'], False), ) def test_load(self, module_name, tags, is_hub_module_v1): path = test_utils.get_test_data_path(module_name) m = module_v2.load(path, tags) self.assertEqual(m._is_hub_module_v1, is_hub_module_v1) @mock.patch.object(module_v2, 'tf_v1')
from tensorflow_hub.feature_column import image_embedding_column from tensorflow_hub.feature_column import text_embedding_column from tensorflow_hub.image_util import get_expected_image_size from tensorflow_hub.image_util import get_num_image_channels from tensorflow_hub.module import load_module_spec from tensorflow_hub.module import Module from tensorflow_hub.module_spec import ModuleSpec from tensorflow_hub.native_module import add_signature from tensorflow_hub.native_module import create_module_spec from tensorflow_hub.saved_model_module import create_module_spec_from_saved_model from tensorflow_hub.version import __version__ # pylint: enable=g-import-not-at-top # pylint: disable=g-bad-import-order from tensorflow_hub.config import _run _run() # pylint: enable=g-bad-import-order # Used by doc generation script. _allowed_symbols = [ "LatestModuleExporter", "register_module_for_export", "image_embedding_column", "text_embedding_column", "get_expected_image_size", "get_num_image_channels", "Module", "ModuleSpec", "add_signature", "create_module_spec", "create_module_spec_from_saved_model",
from tensorflow_hub.estimator import register_module_for_export from tensorflow_hub.feature_column import image_embedding_column from tensorflow_hub.feature_column import text_embedding_column from tensorflow_hub.image_util import get_expected_image_size from tensorflow_hub.image_util import get_num_image_channels from tensorflow_hub.module import Module from tensorflow_hub.module_spec import ModuleSpec from tensorflow_hub.native_module import add_signature from tensorflow_hub.native_module import create_module_spec from tensorflow_hub.native_module import load_module_spec from tensorflow_hub.version import __version__ # pylint: enable=g-import-not-at-top # pylint: disable=g-bad-import-order from tensorflow_hub.config import _run _run() # pylint: enable=g-bad-import-order # Used by doc generation script. _allowed_symbols = [ "LatestModuleExporter", "register_module_for_export", "image_embedding_column", "text_embedding_column", "get_expected_image_size", "get_num_image_channels", "Module", "ModuleSpec", "add_signature", "create_module_spec",