Esempio n. 1
0
    def test_enable_eager_for_tf_1(self, mock_eager_execution, mock_is_tf_v1):
        mock_is_tf_v1.return_value = False
        utils.enable_eager_for_tf_1()
        # Work around as assert_not_called is not supported in py35
        self.assertFalse(mock_eager_execution.called)

        mock_is_tf_v1.return_value = True
        utils.enable_eager_for_tf_1()
        mock_eager_execution.assert_called_once_with()
Esempio n. 2
0
# See the License for the specific language governing permissions and
# limitations under the License.
"""End to end integration test for cloud_fit."""

import os
from typing import Text
import uuid
from absl import logging
import numpy as np
import tensorflow as tf
from tensorflow_cloud.tuner import cloud_fit_client as client
from tensorflow_cloud.tuner import cloud_fit_utils as utils
from tensorflow_cloud.utils import google_api_client

# Can only export Datasets which were created executing eagerly
utils.enable_eager_for_tf_1()

MIRRORED_STRATEGY_NAME = utils.MIRRORED_STRATEGY_NAME
MULTI_WORKER_MIRRORED_STRATEGY_NAME = utils.MULTI_WORKER_MIRRORED_STRATEGY_NAME

# The staging bucket to use to copy the model and data for remote run.
_REMOTE_DIR = os.path.join("gs://", os.environ["TEST_BUCKET"])

# The project id to use to run tests.
_PROJECT_ID = os.environ["PROJECT_ID"]

# The GCP region in which the end-to-end test is run.
_REGION = os.environ["REGION"]

# The base docker image to use for remote environment.
_DOCKER_IMAGE = os.environ["DOCKER_IMAGE"]