Delete load context (this has been moved to Keras in cl/339904054).

PiperOrigin-RevId: 345253837
Change-Id: I50eab33c0e4e23f3203bce92396361961dfe7b17
This commit is contained in:
Katherine Wu 2020-12-02 09:56:25 -08:00 committed by TensorFlower Gardener
parent c7685c0ee7
commit 753786571e
2 changed files with 0 additions and 66 deletions

View File

@ -382,15 +382,6 @@ tf_py_test(
],
)
py_strict_library(
name = "load_context",
srcs = [
"load_context.py",
],
srcs_version = "PY2AND3",
deps = [],
)
py_library(
name = "load",
srcs = [
@ -399,7 +390,6 @@ py_library(
srcs_version = "PY2AND3",
deps = [
":function_deserialization",
":load_context",
":load_options",
":load_v1_in_v2",
":loader",

View File

@ -1,56 +0,0 @@
# Copyright 2020 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Context for storing options for loading a SavedModel."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import contextlib
import threading
class LoadContext(threading.local):
"""A context for loading a model."""
def __init__(self):
super(LoadContext, self).__init__()
self._load_options = None
def set_load_options(self, load_options):
self._load_options = load_options
def clear_load_options(self):
self._load_options = None
def load_options(self):
return self._load_options
_load_context = LoadContext()
@contextlib.contextmanager
def load_context(load_options):
_load_context.set_load_options(load_options)
try:
yield
finally:
_load_context.clear_load_options()
def get_load_options():
"""Returns whether under a load context."""
return _load_context.load_options()