329 lines
12 KiB
Python
329 lines
12 KiB
Python
# Tests of TensorFlow kernels written using the Python API.
|
|
|
|
load("//tensorflow:tensorflow.default.bzl", "cuda_py_strict_test", "tf_py_strict_test")
|
|
|
|
package(
|
|
# copybara:uncomment default_applicable_licenses = ["//tensorflow:license"],
|
|
licenses = ["notice"],
|
|
)
|
|
|
|
# CPU-only tests should use tf_py_test, GPU tests use cuda_py_test
|
|
# Please avoid the py_tests and cuda_py_tests (plural) while we
|
|
# fix the shared/overbroad dependencies.
|
|
|
|
cuda_py_strict_test(
|
|
name = "benchmark_test",
|
|
size = "small",
|
|
srcs = ["benchmark_test.py"],
|
|
tags = ["no_windows"],
|
|
deps = [
|
|
"//tensorflow/core:protos_all_py",
|
|
"//tensorflow/python/client:session",
|
|
"//tensorflow/python/framework:for_generated_wrappers",
|
|
"//tensorflow/python/ops:array_ops",
|
|
"//tensorflow/python/platform:benchmark",
|
|
"//tensorflow/python/platform:client_testlib",
|
|
"//tensorflow/python/platform:gfile",
|
|
],
|
|
)
|
|
|
|
cuda_py_strict_test(
|
|
name = "check_ops_test",
|
|
size = "small",
|
|
srcs = ["check_ops_test.py"],
|
|
xla_tags = [
|
|
"no_cuda_asan", # times out
|
|
],
|
|
deps = [
|
|
"//tensorflow/core:protos_all_py",
|
|
"//tensorflow/python/client:session",
|
|
"//tensorflow/python/eager:context",
|
|
"//tensorflow/python/eager:def_function",
|
|
"//tensorflow/python/framework:constant_op",
|
|
"//tensorflow/python/framework:errors",
|
|
"//tensorflow/python/framework:for_generated_wrappers",
|
|
"//tensorflow/python/framework:sparse_tensor",
|
|
"//tensorflow/python/framework:test_lib",
|
|
"//tensorflow/python/ops:array_ops",
|
|
"//tensorflow/python/ops:check_ops",
|
|
"//tensorflow/python/ops:gradients",
|
|
"//tensorflow/python/ops:math_ops",
|
|
"//tensorflow/python/ops:random_ops",
|
|
"//tensorflow/python/ops/ragged:ragged_factory_ops",
|
|
"//tensorflow/python/platform:client_testlib",
|
|
"//third_party/py/numpy",
|
|
],
|
|
)
|
|
|
|
tf_py_strict_test(
|
|
name = "collective_ops_multi_worker_test",
|
|
size = "medium",
|
|
srcs = ["collective_ops_multi_worker_test.py"],
|
|
tags = [
|
|
"no_mac", # times out on CI but works fine locally
|
|
"no_rocm",
|
|
],
|
|
deps = [
|
|
"//tensorflow/core:protos_all_py",
|
|
"//tensorflow/python/distribute:combinations",
|
|
"//tensorflow/python/distribute:multi_process_runner",
|
|
"//tensorflow/python/distribute:multi_worker_test_base",
|
|
"//tensorflow/python/distribute/cluster_resolver:cluster_resolver_lib",
|
|
"//tensorflow/python/eager:context",
|
|
"//tensorflow/python/eager:test",
|
|
"//tensorflow/python/framework:constant_op",
|
|
"//tensorflow/python/framework:dtypes",
|
|
"//tensorflow/python/framework:errors",
|
|
"//tensorflow/python/framework:ops",
|
|
"//tensorflow/python/ops:collective_ops",
|
|
"@absl_py//absl/testing:parameterized",
|
|
],
|
|
)
|
|
|
|
# b/234468872
|
|
cuda_py_strict_test(
|
|
name = "collective_ops_test",
|
|
size = "medium",
|
|
srcs = ["collective_ops_test.py"],
|
|
shard_count = 4,
|
|
tags = [
|
|
# "multi_and_single_gpu", # TODO(b/287692888): re-enable once the 2gpu test passes.
|
|
"no_tfrt", # TODO(b/185944042)
|
|
],
|
|
deps = [
|
|
"//tensorflow/python/compat:v2_compat",
|
|
"//tensorflow/python/data/experimental/ops:testing",
|
|
"//tensorflow/python/data/ops:dataset_ops",
|
|
"//tensorflow/python/distribute:combinations",
|
|
"//tensorflow/python/distribute:test_util",
|
|
"//tensorflow/python/eager:cancellation",
|
|
"//tensorflow/python/eager:context",
|
|
"//tensorflow/python/eager:def_function",
|
|
"//tensorflow/python/framework:constant_op",
|
|
"//tensorflow/python/framework:errors",
|
|
"//tensorflow/python/framework:for_generated_wrappers",
|
|
"//tensorflow/python/ops:array_ops",
|
|
"//tensorflow/python/ops:check_ops",
|
|
"//tensorflow/python/ops:collective_ops",
|
|
"//tensorflow/python/ops:resource_variable_ops",
|
|
"//tensorflow/python/platform:client_testlib",
|
|
"@absl_py//absl/testing:parameterized",
|
|
],
|
|
)
|
|
|
|
tf_py_strict_test(
|
|
name = "composite_tensor_ops_test",
|
|
size = "small",
|
|
srcs = ["composite_tensor_ops_test.py"],
|
|
deps = [
|
|
"//tensorflow/python/eager:backprop",
|
|
"//tensorflow/python/eager:context",
|
|
"//tensorflow/python/framework:constant_op",
|
|
"//tensorflow/python/framework:errors",
|
|
"//tensorflow/python/framework:for_generated_wrappers",
|
|
"//tensorflow/python/framework:sparse_tensor",
|
|
"//tensorflow/python/framework:test_lib",
|
|
"//tensorflow/python/ops:composite_tensor_ops",
|
|
"//tensorflow/python/ops:composite_tensor_ops_gen",
|
|
"//tensorflow/python/ops:gradients_impl",
|
|
"//tensorflow/python/ops:list_ops_gen",
|
|
"//tensorflow/python/ops:math_ops",
|
|
"//tensorflow/python/ops:parsing_ops",
|
|
"//tensorflow/python/ops:sparse_ops",
|
|
"//tensorflow/python/ops/ragged:ragged_factory_ops",
|
|
"//tensorflow/python/ops/ragged:ragged_tensor",
|
|
"//tensorflow/python/platform:test",
|
|
"//tensorflow/python/util:nest",
|
|
"@absl_py//absl/testing:parameterized",
|
|
],
|
|
)
|
|
|
|
cuda_py_strict_test(
|
|
name = "critical_section_test",
|
|
size = "medium",
|
|
srcs = ["critical_section_test.py"],
|
|
deps = [
|
|
"//tensorflow/python/data/experimental/ops:prefetching_ops",
|
|
"//tensorflow/python/data/ops:dataset_ops",
|
|
"//tensorflow/python/eager:context",
|
|
"//tensorflow/python/eager:def_function",
|
|
"//tensorflow/python/framework:for_generated_wrappers",
|
|
"//tensorflow/python/framework:test_lib",
|
|
"//tensorflow/python/ops:array_ops",
|
|
"//tensorflow/python/ops:cond",
|
|
"//tensorflow/python/ops:control_flow_assert",
|
|
"//tensorflow/python/ops:control_flow_ops",
|
|
"//tensorflow/python/ops:control_flow_v2_toggles",
|
|
"//tensorflow/python/ops:critical_section_ops",
|
|
"//tensorflow/python/ops:resource_variable_ops",
|
|
"//tensorflow/python/ops:while_loop",
|
|
"//tensorflow/python/platform:client_testlib",
|
|
"//tensorflow/python/platform:tf_logging",
|
|
"@absl_py//absl/testing:parameterized",
|
|
],
|
|
)
|
|
|
|
tf_py_strict_test(
|
|
name = "garbage_collection_test",
|
|
size = "small",
|
|
srcs = ["garbage_collection_test.py"],
|
|
deps = [
|
|
"//tensorflow/python/eager:context",
|
|
"//tensorflow/python/framework:dtypes",
|
|
"//tensorflow/python/framework:test_lib",
|
|
"//tensorflow/python/ops:resource_variable_ops",
|
|
"//tensorflow/python/ops:tensor_array_ops",
|
|
"//tensorflow/python/platform:client_testlib",
|
|
],
|
|
)
|
|
|
|
cuda_py_strict_test(
|
|
name = "gradient_correctness_test",
|
|
size = "small",
|
|
srcs = ["gradient_correctness_test.py"],
|
|
deps = [
|
|
"//tensorflow/python/eager:context",
|
|
"//tensorflow/python/framework:constant_op",
|
|
"//tensorflow/python/framework:for_generated_wrappers",
|
|
"//tensorflow/python/framework:test_lib",
|
|
"//tensorflow/python/ops:math_ops",
|
|
"//tensorflow/python/platform:client_testlib",
|
|
"//third_party/py/numpy",
|
|
"@absl_py//absl/testing:parameterized",
|
|
],
|
|
)
|
|
|
|
tf_py_strict_test(
|
|
name = "logging_ops_logging_level_test",
|
|
size = "small",
|
|
srcs = ["logging_ops_logging_level_test.py"],
|
|
tags = [
|
|
"no_oss", # b/198486357
|
|
"no_windows",
|
|
],
|
|
deps = [
|
|
"//tensorflow/python/framework:test_lib",
|
|
"//tensorflow/python/ops:logging_ops",
|
|
"//tensorflow/python/ops:math_ops",
|
|
"//tensorflow/python/platform:client_testlib",
|
|
"//tensorflow/python/platform:tf_logging",
|
|
],
|
|
)
|
|
|
|
cuda_py_strict_test(
|
|
name = "logging_ops_test",
|
|
size = "medium",
|
|
srcs = ["logging_ops_test.py"],
|
|
deps = [
|
|
"//tensorflow/python/eager:context",
|
|
"//tensorflow/python/eager:def_function",
|
|
"//tensorflow/python/framework:constant_op",
|
|
"//tensorflow/python/framework:for_generated_wrappers",
|
|
"//tensorflow/python/framework:sparse_tensor",
|
|
"//tensorflow/python/framework:test_lib",
|
|
"//tensorflow/python/ops:control_flow_assert",
|
|
"//tensorflow/python/ops:gradients_impl",
|
|
"//tensorflow/python/ops:logging_ops",
|
|
"//tensorflow/python/ops:math_ops",
|
|
"//tensorflow/python/ops:string_ops",
|
|
"//tensorflow/python/ops:variables",
|
|
"//tensorflow/python/platform:client_testlib",
|
|
],
|
|
)
|
|
|
|
tf_py_strict_test(
|
|
name = "metrics_test",
|
|
size = "medium",
|
|
srcs = ["metrics_test.py"],
|
|
shard_count = 20,
|
|
tags = ["no_windows_gpu"],
|
|
deps = [
|
|
"//tensorflow/python/framework:constant_op",
|
|
"//tensorflow/python/framework:errors",
|
|
"//tensorflow/python/framework:for_generated_wrappers",
|
|
"//tensorflow/python/framework:sparse_tensor",
|
|
"//tensorflow/python/framework:test_lib",
|
|
"//tensorflow/python/ops:array_ops",
|
|
"//tensorflow/python/ops:data_flow_grad",
|
|
"//tensorflow/python/ops:data_flow_ops",
|
|
"//tensorflow/python/ops:math_ops",
|
|
"//tensorflow/python/ops:metrics",
|
|
"//tensorflow/python/ops:nn_grad",
|
|
"//tensorflow/python/ops:random_ops",
|
|
"//tensorflow/python/ops:variables",
|
|
"//tensorflow/python/platform:client_testlib",
|
|
"//third_party/py/numpy",
|
|
],
|
|
)
|
|
|
|
cuda_py_strict_test(
|
|
name = "numerics_test",
|
|
size = "small",
|
|
srcs = ["numerics_test.py"],
|
|
deps = [
|
|
"//tensorflow/python/framework:constant_op",
|
|
"//tensorflow/python/framework:for_generated_wrappers",
|
|
"//tensorflow/python/framework:test_lib",
|
|
"//tensorflow/python/ops:array_ops",
|
|
"//tensorflow/python/ops:cond",
|
|
"//tensorflow/python/ops:control_flow_ops",
|
|
"//tensorflow/python/ops:math_ops",
|
|
"//tensorflow/python/ops:numerics",
|
|
"//tensorflow/python/ops:while_loop",
|
|
"//tensorflow/python/platform:client_testlib",
|
|
"//third_party/py/numpy",
|
|
],
|
|
)
|
|
|
|
tf_py_strict_test(
|
|
name = "template_test",
|
|
size = "small",
|
|
srcs = ["template_test.py"],
|
|
deps = [
|
|
"//tensorflow/python/client:session",
|
|
"//tensorflow/python/eager:context",
|
|
"//tensorflow/python/framework:ops",
|
|
"//tensorflow/python/framework:random_seed",
|
|
"//tensorflow/python/framework:test_lib",
|
|
"//tensorflow/python/ops:array_ops",
|
|
"//tensorflow/python/ops:init_ops",
|
|
"//tensorflow/python/ops:math_ops",
|
|
"//tensorflow/python/ops:nn_grad",
|
|
"//tensorflow/python/ops:template",
|
|
"//tensorflow/python/ops:variable_scope",
|
|
"//tensorflow/python/ops:variables",
|
|
"//tensorflow/python/platform:client_testlib",
|
|
"//tensorflow/python/training:gradient_descent",
|
|
],
|
|
)
|
|
|
|
cuda_py_strict_test(
|
|
name = "trace_op_test",
|
|
size = "small",
|
|
srcs = ["trace_op_test.py"],
|
|
tags = ["no_windows_gpu"],
|
|
deps = [
|
|
"//tensorflow/python/framework:test_lib",
|
|
"//tensorflow/python/ops:math_ops",
|
|
"//tensorflow/python/platform:client_testlib",
|
|
"//third_party/py/numpy",
|
|
],
|
|
)
|
|
|
|
cuda_py_strict_test(
|
|
name = "histogram_ops_test",
|
|
size = "small",
|
|
srcs = ["histogram_ops_test.py"],
|
|
deps = [
|
|
"//tensorflow/python/framework:constant_op",
|
|
"//tensorflow/python/framework:dtypes",
|
|
"//tensorflow/python/framework:errors",
|
|
"//tensorflow/python/framework:test_lib",
|
|
"//tensorflow/python/ops:array_ops",
|
|
"//tensorflow/python/ops:histogram_ops",
|
|
"//tensorflow/python/platform:client_testlib",
|
|
"//third_party/py/numpy",
|
|
"@absl_py//absl/testing:parameterized",
|
|
],
|
|
)
|