Skip to content

Commit cff5372

Browse files
skyetensorflower-gardener
authored andcommitted
Split up function.py into multiple files.
This change adds func_graph.py and auto_control_deps.py. This is purely copy/pasting code from function.py and function_test.py to these new files, plus changing imports and minor lint fixes. PiperOrigin-RevId: 217942335
1 parent 230d003 commit cff5372

16 files changed

Lines changed: 1194 additions & 1051 deletions

tensorflow/python/BUILD

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,42 @@ py_library(
863863
],
864864
)
865865

866+
py_library(
867+
name = "func_graph",
868+
srcs = ["framework/func_graph.py"],
869+
srcs_version = "PY2AND3",
870+
deps = [
871+
":auto_control_deps",
872+
":framework_ops",
873+
"//tensorflow/python/autograph",
874+
"//tensorflow/python/eager:context",
875+
"//tensorflow/python/eager:graph_only_ops",
876+
"//tensorflow/python/eager:tape",
877+
],
878+
)
879+
880+
py_library(
881+
name = "auto_control_deps",
882+
srcs = ["framework/auto_control_deps.py"],
883+
srcs_version = "PY2AND3",
884+
deps = [
885+
":control_flow_ops",
886+
":framework_ops",
887+
":util",
888+
],
889+
)
890+
891+
py_test(
892+
name = "auto_control_deps_test",
893+
size = "small",
894+
srcs = ["framework/auto_control_deps_test.py"],
895+
srcs_version = "PY2AND3",
896+
deps = [
897+
":auto_control_deps",
898+
":client_testlib",
899+
],
900+
)
901+
866902
py_library(
867903
name = "random_seed",
868904
srcs = ["framework/random_seed.py"],

tensorflow/python/eager/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,10 @@ py_library(
252252
"//tensorflow/python:dtypes",
253253
"//tensorflow/python:errors",
254254
"//tensorflow/python:framework_ops",
255+
"//tensorflow/python:func_graph",
255256
"//tensorflow/python:gradients_impl",
256257
"//tensorflow/python:graph_to_function_def",
257258
"//tensorflow/python:util",
258-
"//tensorflow/python/autograph",
259259
"//tensorflow/python/eager:context",
260260
"//tensorflow/python/eager:core",
261261
"//tensorflow/python/eager:execute",

tensorflow/python/eager/context.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,11 @@ def set_server_def(server_def):
832832
context().set_server_def(server_def)
833833

834834

835+
def add_function(fdef):
836+
"""Add a function definition to the context."""
837+
context().add_function(fdef)
838+
839+
835840
# Not every user creates a Context via context.context()
836841
# (for example, enable_eager_execution in python/framework/ops.py),
837842
# but they do all import this file. Note that IS_IN_GRAPH_MODE and

0 commit comments

Comments
 (0)