blob: 7dea85f567c0013894b749fc90cbd2b96b29c67a [file] [log] [blame]
# Description:
# Contains the Keras API (internal TensorFlow version).
load("//tensorflow:tensorflow.bzl", "tf_py_test")
package(
default_visibility = ["//visibility:public"],
licenses = ["notice"],
)
filegroup(
name = "all_py_srcs",
srcs = glob(["*.py"]),
visibility = [
"//tensorflow/python/keras/google/private_tf_api_test:__pkg__",
],
)
config_setting(
name = "no_keras_py_deps",
define_values = {"no_keras_py_deps": "true"},
visibility = ["//visibility:public"],
)
py_library(
name = "keras",
srcs = [
"__init__.py",
"keras_parameterized.py",
],
srcs_version = "PY3",
deps = [
":backend",
":engine",
":testing_utils", # TODO(scottzhu): Stop exporting the test_utils after removing all the callers.
"//tensorflow/python:training",
"//tensorflow/python/keras/distribute",
"//tensorflow/python/keras/feature_column",
"//tensorflow/python/keras/layers",
"//tensorflow/python/keras/mixed_precision:mixed_precision_experimental",
"//tensorflow/python/keras/optimizer_v2",
"//tensorflow/python/keras/premade",
"//tensorflow/python/keras/saving",
"//tensorflow/python/keras/utils",
"//tensorflow/python/keras/wrappers",
"//tensorflow/python/saved_model",
],
)
py_library(
name = "backend",
srcs = ["backend.py"],
srcs_version = "PY3",
deps = [
":backend_config",
"//tensorflow/core:protos_all_py",
"//tensorflow/python:array_ops",
"//tensorflow/python:check_ops",
"//tensorflow/python:client",
"//tensorflow/python:clip_ops",
"//tensorflow/python:constant_op",
"//tensorflow/python:control_flow_ops",
"//tensorflow/python:ctc_ops",
"//tensorflow/python:dtypes",
"//tensorflow/python:framework",
"//tensorflow/python:framework_ops",
"//tensorflow/python:functional_ops",
"//tensorflow/python:gradients",
"//tensorflow/python:image_ops",
"//tensorflow/python:init_ops",
"//tensorflow/python:init_ops_v2",
"//tensorflow/python:logging_ops",
"//tensorflow/python:map_fn",
"//tensorflow/python:math_ops",
"//tensorflow/python:metrics",
"//tensorflow/python:nn",
"//tensorflow/python:platform",
"//tensorflow/python:random_ops",
"//tensorflow/python:session",
"//tensorflow/python:sparse_ops",
"//tensorflow/python:sparse_tensor",
"//tensorflow/python:state_ops",
"//tensorflow/python:tensor_array_grad",
"//tensorflow/python:tensor_array_ops",
"//tensorflow/python:tensor_shape",
"//tensorflow/python:training_lib",
"//tensorflow/python:util",
"//tensorflow/python:variables",
"//tensorflow/python/distribute:distribute_coordinator",
"//tensorflow/python/distribute:distribute_lib",
"//tensorflow/python/distribute:multi_worker_util",
"//tensorflow/python/keras/distribute:distribute_coordinator_utils",
"//tensorflow/python/keras/engine:keras_tensor",
"//tensorflow/python/keras/utils:control_flow_util",
"//tensorflow/python/keras/utils:object_identity",
"//tensorflow/python/keras/utils:tf_contextlib",
"//tensorflow/python/keras/utils:tf_inspect",
"//tensorflow/python/summary",
],
)
py_library(
name = "backend_config",
srcs = ["backend_config.py"],
srcs_version = "PY3",
deps = [
"//tensorflow/python:util",
],
)
# TODO(scottzhu): Cleanup this target and point all the user to keras/engine.
py_library(
name = "engine",
srcs = [
":metrics",
":models",
],
srcs_version = "PY3",
deps = [
"//tensorflow/python/keras/engine",
],
)
py_library(
name = "activations",
srcs = [
"activations.py",
],
srcs_version = "PY3",
deps = [
":backend",
"//tensorflow/python/keras/layers:advanced_activations",
"//tensorflow/python/keras/utils:engine_utils",
],
)
# TODO(scottzhu): Cleanup this target and point all the user to keras/engine.
py_library(
name = "base_layer",
srcs = [],
srcs_version = "PY3",
deps = [
"//tensorflow/python/keras/engine:base_layer",
],
)
py_library(
name = "callbacks",
srcs = [
"callbacks.py",
],
srcs_version = "PY3",
deps = [
":backend",
"//tensorflow/python:errors",
"//tensorflow/python/keras/distribute:distributed_file_utils",
"//tensorflow/python/keras/distribute:worker_training_state",
"//tensorflow/python/keras/protobuf:projector_config_proto_py",
"//tensorflow/python/keras/utils:engine_utils",
"//tensorflow/python/keras/utils:mode_keys",
"//tensorflow/python/profiler:profiler_v2",
"//tensorflow/tools/docs:doc_controls",
],
)
py_library(
name = "combinations",
srcs = [
"combinations.py",
],
srcs_version = "PY3",
deps = [
":testing_utils",
"//tensorflow/python:framework_combinations",
"//tensorflow/python:framework_test_combinations_lib",
"//tensorflow/python:tf2",
],
)
py_library(
name = "callbacks_v1",
srcs = [
"callbacks_v1.py",
],
srcs_version = "PY3",
deps = [
":backend",
"//tensorflow/python:errors",
"//tensorflow/python/keras/utils:engine_utils",
"//tensorflow/python/profiler:profiler_v2",
],
)
py_library(
name = "constraints",
srcs = [
"constraints.py",
],
srcs_version = "PY3",
deps = [
":backend",
"//tensorflow/python/keras/utils:engine_utils",
],
)
py_library(
name = "losses",
srcs = [
"losses.py",
],
srcs_version = "PY3",
deps = [
":backend",
"//tensorflow/python/keras/utils:engine_utils",
],
)
py_library(
name = "metrics",
srcs = [
"metrics.py",
],
srcs_version = "PY3",
deps = [
":activations",
":backend",
":losses",
"//tensorflow/python:array_ops",
"//tensorflow/python:check_ops",
"//tensorflow/python:confusion_matrix",
"//tensorflow/python:constant_op",
"//tensorflow/python:dtypes",
"//tensorflow/python:framework_ops",
"//tensorflow/python:init_ops",
"//tensorflow/python:math_ops",
"//tensorflow/python:nn",
"//tensorflow/python:tensor_shape",
"//tensorflow/python:util",
"//tensorflow/python:variables",
"//tensorflow/python:weights_broadcast_ops",
"//tensorflow/python/distribute:distribute_lib",
"//tensorflow/python/eager:context",
"//tensorflow/python/eager:def_function",
"//tensorflow/python/keras/distribute",
"//tensorflow/python/keras/engine:base_layer",
"//tensorflow/python/keras/engine:base_layer_utils",
"//tensorflow/python/keras/utils:generic_utils",
"//tensorflow/python/keras/utils:metrics_utils",
"//tensorflow/python/keras/utils:tf_utils",
"//tensorflow/python/ops/losses",
"//tensorflow/tools/docs:doc_controls",
"//third_party/py/numpy",
],
)
py_library(
name = "models",
srcs = [
"models.py",
],
srcs_version = "PY3",
deps = [
":backend",
":metrics",
":optimizers",
"//tensorflow/python:platform",
"//tensorflow/python:util",
"//tensorflow/python/keras/engine",
"//tensorflow/python/keras/engine:base_layer",
"//tensorflow/python/keras/saving",
"//tensorflow/python/keras/utils:generic_utils",
"//tensorflow/python/keras/utils:version_utils",
],
)
py_library(
name = "optimizers",
srcs = [
"optimizer_v1.py",
"optimizers.py",
],
srcs_version = "PY3",
deps = [
":backend",
"//tensorflow/python/keras/optimizer_v2",
"//tensorflow/python/keras/utils:engine_utils",
],
)
py_library(
name = "regularizers",
srcs = [
"regularizers.py",
],
srcs_version = "PY3",
deps = [
":backend",
"//tensorflow/python/keras/utils:engine_utils",
],
)
# Internally urllib.request.urlretrieve library requires Google
# SSL context to be provided to work in python 3. This isn't needed in OSS.
# copybara:uncomment_begin(google-only)
# py_library(
# name = "url_utils",
# srcs = ["google/url_utils.py"],
# srcs_version = "PY3",
# deps = ["//pyglib/contrib/google_ssl"],
# )
# copybara:uncomment_end
py_library(
name = "testing_utils",
srcs = [
"testing_utils.py",
],
srcs_version = "PY3",
deps = [
":backend",
":models",
"//tensorflow/python:config",
"//tensorflow/python:framework_test_lib",
"//tensorflow/python:tensor_shape",
"//tensorflow/python:tensor_spec",
"//tensorflow/python:tf2",
"//tensorflow/python:util",
"//tensorflow/python/eager:context",
"//tensorflow/python/keras/engine:base_layer_utils",
"//tensorflow/python/keras/layers",
"//tensorflow/python/keras/optimizer_v2",
"//third_party/py/numpy",
],
)
tf_py_test(
name = "activations_test",
size = "small",
srcs = ["activations_test.py"],
python_version = "PY3",
deps = [
":activations",
":backend",
":combinations",
"//tensorflow/python:client_testlib",
"//tensorflow/python:nn_ops",
"//tensorflow/python/keras/layers",
"//tensorflow/python/keras/layers:advanced_activations",
"//tensorflow/python/keras/layers:core",
"//third_party/py/numpy",
"@absl_py//absl/testing:parameterized",
],
)
tf_py_test(
name = "combinations_test",
size = "small",
srcs = ["combinations_test.py"],
python_version = "PY3",
deps = [
":combinations",
":testing_utils",
"//tensorflow/python:client_testlib",
"//tensorflow/python:extra_py_tests_deps",
"//tensorflow/python:tf2",
"//tensorflow/python/eager:context",
"@absl_py//absl/testing:parameterized",
],
)
tf_py_test(
name = "constraints_test",
size = "small",
srcs = ["constraints_test.py"],
python_version = "PY3",
deps = [
":backend",
":combinations",
":constraints",
"//tensorflow/python:client_testlib",
"//third_party/py/numpy",
],
)
tf_py_test(
name = "regularizers_test",
size = "medium",
srcs = ["regularizers_test.py"],
python_version = "PY3",
deps = [
":keras",
"//tensorflow/python:client_testlib",
"@absl_py//absl/testing:parameterized",
],
)
tf_py_test(
name = "optimizers_test",
size = "medium",
srcs = ["optimizers_test.py"],
python_version = "PY3",
shard_count = 8,
tags = ["notsan"],
deps = [
":keras",
"//tensorflow/python:client_testlib",
"//tensorflow/python:training",
"//third_party/py/numpy",
"@absl_py//absl/testing:parameterized",
],
)
tf_py_test(
name = "losses_test",
size = "small",
srcs = ["losses_test.py"],
python_version = "PY3",
tags = [
"noasan", # b/186128525
],
deps = [
":backend",
":combinations",
":losses",
"//tensorflow/python:client_testlib",
"//tensorflow/python:constant_op",
"//tensorflow/python:dtypes",
"//tensorflow/python:errors",
"//tensorflow/python:framework_ops",
"//tensorflow/python:framework_test_lib",
"//tensorflow/python/keras/utils:engine_utils",
"//third_party/py/numpy",
],
)
tf_py_test(
name = "metrics_functional_test",
size = "small",
srcs = ["metrics_functional_test.py"],
python_version = "PY3",
deps = [
":combinations",
":keras",
"//tensorflow/python:client_testlib",
"//third_party/py/numpy",
],
)
tf_py_test(
name = "metrics_test",
size = "medium",
srcs = ["metrics_test.py"],
python_version = "PY3",
shard_count = 4,
deps = [
":combinations",
":keras",
":metrics",
":testing_utils",
"//tensorflow/python:array_ops",
"//tensorflow/python:client_testlib",
"//tensorflow/python:constant_op",
"//tensorflow/python:dtypes",
"//tensorflow/python:errors",
"//tensorflow/python:framework_ops",
"//tensorflow/python:framework_test_lib",
"//tensorflow/python:math_ops",
"//tensorflow/python:variables",
"//tensorflow/python:weights_broadcast_ops",
"//tensorflow/python/eager:context",
"//tensorflow/python/eager:def_function",
"//tensorflow/python/eager:function",
"//tensorflow/python/keras/layers",
"//tensorflow/python/ops/ragged:ragged_factory_ops",
"//tensorflow/python/training/tracking:util",
"//third_party/py/numpy",
],
)
tf_py_test(
name = "metrics_confusion_matrix_test",
size = "medium",
srcs = ["metrics_confusion_matrix_test.py"],
python_version = "PY3",
shard_count = 4,
deps = [
":combinations",
":metrics",
":models",
"//tensorflow/python:client_testlib",
"//tensorflow/python:constant_op",
"//tensorflow/python:dtypes",
"//tensorflow/python:math_ops",
"//tensorflow/python:random_ops",
"//tensorflow/python:variables",
"//tensorflow/python/keras/layers",
"//tensorflow/python/keras/utils:metrics_utils",
"//third_party/py/numpy",
"@absl_py//absl/testing:parameterized",
],
)
tf_py_test(
name = "metrics_correctness_test",
size = "medium",
srcs = ["metrics_correctness_test.py"],
python_version = "PY3",
shard_count = 4,
deps = [
":keras",
"//tensorflow/python:client_testlib",
"//third_party/py/numpy",
"@absl_py//absl/testing:parameterized",
],
)
tf_py_test(
name = "callbacks_test",
size = "medium",
srcs = ["callbacks_test.py"],
python_version = "PY3",
shard_count = 6,
tags = [
"no_oss",
"no_tfrt", # TODO(b/179690526)
"notsan",
],
deps = [
":keras",
"//tensorflow/python/profiler:profiler_v2",
"//third_party/py/numpy",
"@absl_py//absl/testing:parameterized",
],
)
tf_py_test(
name = "callbacks_v1_test",
size = "medium",
srcs = ["callbacks_v1_test.py"],
python_version = "PY3",
tags = ["notsan"],
deps = [
":callbacks",
":callbacks_v1",
":combinations",
":testing_utils",
"//tensorflow/python:client_testlib",
"//tensorflow/python:framework_ops",
"//tensorflow/python:training_lib",
"//tensorflow/python/keras/engine",
"//tensorflow/python/keras/layers",
"//tensorflow/python/keras/utils:np_utils",
"//third_party/py/numpy",
"@absl_py//absl/testing:parameterized",
],
)
tf_py_test(
name = "models_test",
size = "medium",
srcs = ["models_test.py"],
python_version = "PY3",
shard_count = 8,
tags = [
"notsan", # b/67509773
],
deps = [
":keras",
"//tensorflow/python:client_testlib",
"//tensorflow/python:training",
"//third_party/py/numpy",
"@absl_py//absl/testing:parameterized",
],
)
tf_py_test(
name = "backend_test",
size = "medium",
srcs = ["backend_test.py"],
python_version = "PY3",
shard_count = 4,
deps = [
":backend",
":combinations",
":engine",
"//tensorflow/core:protos_all_py",
"//tensorflow/python:array_ops",
"//tensorflow/python:client_testlib",
"//tensorflow/python:config",
"//tensorflow/python:errors",
"//tensorflow/python:extra_py_tests_deps",
"//tensorflow/python:framework_ops",
"//tensorflow/python:framework_test_lib",
"//tensorflow/python:nn",
"//tensorflow/python:sparse_tensor",
"//tensorflow/python:util",
"//tensorflow/python:variables",
"//tensorflow/python/eager:context",
"//tensorflow/python/eager:def_function",
"//third_party/py/numpy",
"@absl_py//absl/testing:parameterized",
],
)
tf_py_test(
name = "backend_config_test",
size = "medium",
srcs = ["backend_config_test.py"],
python_version = "PY3",
deps = [
":backend",
":backend_config",
":combinations",
"//tensorflow/python:client_testlib",
],
)
tf_py_test(
name = "keras_parameterized_test",
size = "small",
srcs = ["keras_parameterized_test.py"],
python_version = "PY3",
tags = ["notsan"],
deps = [
":keras",
"//tensorflow/python:client_testlib",
"//third_party/py/numpy",
"@absl_py//absl/testing:parameterized",
],
)
# copybara:uncomment_begin(google-only)
# tf_py_test(
# name = "url_utils_test",
# srcs = ["google/url_utils_test.py"],
# python_version = "PY3",
# deps = [
# ":url_utils",
# "//testing/pymocks:matchers",
# "//tensorflow/python:client_testlib",
# ],
# )
# copybara:uncomment_end