Don't use the heavyweight tf_stack in tf_decorator, which only needs the name of the parent frame. Remove package dependency.
PiperOrigin-RevId: 342089411 Change-Id: Id0aeb501f799cb829bca59fd3345e844e44a395a
This commit is contained in:
parent
1028958173
commit
9aec83d8e6
@ -5688,7 +5688,7 @@ py_strict_library(
|
|||||||
"util/tf_inspect.py",
|
"util/tf_inspect.py",
|
||||||
],
|
],
|
||||||
compatible_with = get_compatible_with_portable(),
|
compatible_with = get_compatible_with_portable(),
|
||||||
srcs_version = "PY2AND3",
|
srcs_version = "PY3",
|
||||||
visibility = [
|
visibility = [
|
||||||
"//tensorflow:__subpackages__",
|
"//tensorflow:__subpackages__",
|
||||||
# TODO(mdan): Remove these dependencies.
|
# TODO(mdan): Remove these dependencies.
|
||||||
@ -5696,12 +5696,12 @@ py_strict_library(
|
|||||||
"//learning/deepmind/research/language/translation/lm:__subpackages__",
|
"//learning/deepmind/research/language/translation/lm:__subpackages__",
|
||||||
],
|
],
|
||||||
deps = [
|
deps = [
|
||||||
":tf_stack",
|
|
||||||
"@six_archive//:six",
|
"@six_archive//:six",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Leaf library: may not depend on anything else inside TensorFlow.
|
# Note: this is a heavyweight library specialized for TensorFlow graphs. Do not use for
|
||||||
|
# other purposes.
|
||||||
py_strict_library(
|
py_strict_library(
|
||||||
name = "tf_stack",
|
name = "tf_stack",
|
||||||
srcs = ["util/tf_stack.py"],
|
srcs = ["util/tf_stack.py"],
|
||||||
|
|||||||
@ -61,8 +61,6 @@ from __future__ import print_function
|
|||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
|
|
||||||
from tensorflow.python.util import tf_stack
|
|
||||||
|
|
||||||
|
|
||||||
def make_decorator(target,
|
def make_decorator(target,
|
||||||
decorator_func,
|
decorator_func,
|
||||||
@ -84,8 +82,7 @@ def make_decorator(target,
|
|||||||
The `decorator_func` argument with new metadata attached.
|
The `decorator_func` argument with new metadata attached.
|
||||||
"""
|
"""
|
||||||
if decorator_name is None:
|
if decorator_name is None:
|
||||||
frame = tf_stack.extract_stack(limit=2)[0]
|
decorator_name = inspect.currentframe().f_back.f_code.co_name
|
||||||
decorator_name = frame.name
|
|
||||||
decorator = TFDecorator(decorator_name, target, decorator_doc,
|
decorator = TFDecorator(decorator_name, target, decorator_doc,
|
||||||
decorator_argspec)
|
decorator_argspec)
|
||||||
setattr(decorator_func, '_tf_decorator', decorator)
|
setattr(decorator_func, '_tf_decorator', decorator)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user