Make forward compatibility utilities visible as tf.compat.forward_compatible.
PiperOrigin-RevId: 204927574
This commit is contained in:
parent
97b1ef3ee8
commit
6971bc84c3
@ -9,6 +9,7 @@ py_library(
|
|||||||
srcs = ["compat.py"],
|
srcs = ["compat.py"],
|
||||||
srcs_version = "PY2AND3",
|
srcs_version = "PY2AND3",
|
||||||
visibility = ["//tensorflow:internal"],
|
visibility = ["//tensorflow:internal"],
|
||||||
|
deps = ["//tensorflow/python:util"],
|
||||||
)
|
)
|
||||||
|
|
||||||
tf_py_test(
|
tf_py_test(
|
||||||
|
@ -24,13 +24,17 @@ from __future__ import print_function
|
|||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
from tensorflow.python.util import tf_contextlib
|
from tensorflow.python.util import tf_contextlib
|
||||||
|
from tensorflow.python.util.tf_export import tf_export
|
||||||
|
|
||||||
_FORWARD_COMPATIBILITY_HORIZON = datetime.date(2018, 8, 1)
|
_FORWARD_COMPATIBILITY_HORIZON = datetime.date(2018, 8, 1)
|
||||||
|
|
||||||
|
|
||||||
|
@tf_export("compat.forward_compatible")
|
||||||
def forward_compatible(year, month, day):
|
def forward_compatible(year, month, day):
|
||||||
"""Return true if the forward compatibility window has expired.
|
"""Return true if the forward compatibility window has expired.
|
||||||
|
|
||||||
|
See @{$guide/version_compat#backward_and_partial_forward_compatibility}.
|
||||||
|
|
||||||
Forward-compatibility refers to scenarios where the producer of a TensorFlow
|
Forward-compatibility refers to scenarios where the producer of a TensorFlow
|
||||||
model (a GraphDef or SavedModel) is compiled against a version of the
|
model (a GraphDef or SavedModel) is compiled against a version of the
|
||||||
TensorFlow library newer than what the consumer was compiled against. The
|
TensorFlow library newer than what the consumer was compiled against. The
|
||||||
@ -82,10 +86,13 @@ def forward_compatible(year, month, day):
|
|||||||
return _FORWARD_COMPATIBILITY_HORIZON > datetime.date(year, month, day)
|
return _FORWARD_COMPATIBILITY_HORIZON > datetime.date(year, month, day)
|
||||||
|
|
||||||
|
|
||||||
|
@tf_export("compat.forward_compatibility_horizon")
|
||||||
@tf_contextlib.contextmanager
|
@tf_contextlib.contextmanager
|
||||||
def forward_compatibility_horizon(year, month, day):
|
def forward_compatibility_horizon(year, month, day):
|
||||||
"""Context manager for testing forward compatibility of generated graphs.
|
"""Context manager for testing forward compatibility of generated graphs.
|
||||||
|
|
||||||
|
See @{$guide/version_compat#backward_and_partial_forward_compatibility}.
|
||||||
|
|
||||||
To ensure forward compatibility of generated graphs (see `forward_compatible`)
|
To ensure forward compatibility of generated graphs (see `forward_compatible`)
|
||||||
with older binaries, new features can be gated with:
|
with older binaries, new features can be gated with:
|
||||||
|
|
||||||
|
@ -32,6 +32,14 @@ tf_module {
|
|||||||
name: "as_text"
|
name: "as_text"
|
||||||
argspec: "args=[\'bytes_or_text\', \'encoding\'], varargs=None, keywords=None, defaults=[\'utf-8\'], "
|
argspec: "args=[\'bytes_or_text\', \'encoding\'], varargs=None, keywords=None, defaults=[\'utf-8\'], "
|
||||||
}
|
}
|
||||||
|
member_method {
|
||||||
|
name: "forward_compatibility_horizon"
|
||||||
|
argspec: "args=[\'year\', \'month\', \'day\'], varargs=None, keywords=None, defaults=None"
|
||||||
|
}
|
||||||
|
member_method {
|
||||||
|
name: "forward_compatible"
|
||||||
|
argspec: "args=[\'year\', \'month\', \'day\'], varargs=None, keywords=None, defaults=None"
|
||||||
|
}
|
||||||
member_method {
|
member_method {
|
||||||
name: "path_to_str"
|
name: "path_to_str"
|
||||||
argspec: "args=[\'path\'], varargs=None, keywords=None, defaults=None"
|
argspec: "args=[\'path\'], varargs=None, keywords=None, defaults=None"
|
||||||
|
Loading…
Reference in New Issue
Block a user