diff --git a/tensorflow/contrib/optimizer_v2/BUILD b/tensorflow/contrib/optimizer_v2/BUILD index 2cf445a85ec..0700b7c73c3 100644 --- a/tensorflow/contrib/optimizer_v2/BUILD +++ b/tensorflow/contrib/optimizer_v2/BUILD @@ -48,7 +48,7 @@ py_library( srcs_version = "PY2AND3", deps = [ "//tensorflow/python:util", - "//tensorflow/python/keras:optimizer_v2", + "//tensorflow/python/keras/optimizer_v2", ], ) diff --git a/tensorflow/python/keras/BUILD b/tensorflow/python/keras/BUILD index a566c9acaba..7b57871e770 100755 --- a/tensorflow/python/keras/BUILD +++ b/tensorflow/python/keras/BUILD @@ -62,7 +62,7 @@ py_library( ":backend", ":engine", ":layers", - ":optimizer_v2", + "//tensorflow/python/keras/optimizer_v2:optimizer_v2", "//tensorflow/python/saved_model", "//tensorflow/python:training", ], @@ -190,30 +190,6 @@ py_library( ], ) -py_library( - name = "optimizer_v2", - srcs = [ - "optimizer_v2/adadelta.py", - "optimizer_v2/adagrad.py", - "optimizer_v2/adam.py", - "optimizer_v2/optimizer_v2.py", - "optimizer_v2/rmsprop.py", - "optimizer_v2/sgd.py", - ], - srcs_version = "PY2AND3", - deps = [ - "//tensorflow/python:control_flow_ops", - "//tensorflow/python:distribute", - "//tensorflow/python:framework", - "//tensorflow/python:math_ops", - "//tensorflow/python:resource_variable_ops", - "//tensorflow/python:state_ops", - "//tensorflow/python:training", - "//tensorflow/python:variable_scope", - "//tensorflow/python:variables", - ], -) - py_test( name = "integration_test", size = "medium", @@ -865,133 +841,3 @@ py_library( "//third_party/py/numpy", ], ) - -cuda_py_test( - name = "adadelta_test", - size = "medium", - srcs = ["optimizer_v2/adadelta_test.py"], - additional_deps = [ - ":optimizer_v2", - "//tensorflow/python:client_testlib", - "//tensorflow/python:embedding_ops", - "//tensorflow/python:framework", - "//tensorflow/python:math_ops", - "//tensorflow/python:platform", - "//tensorflow/python:platform_test", - "//tensorflow/python:resource_variable_ops", - "//tensorflow/python:variables", - "//third_party/py/numpy", - ], -) - -cuda_py_test( - name = "adagrad_test", - size = "small", - srcs = ["optimizer_v2/adagrad_test.py"], - additional_deps = [ - ":optimizer_v2", - "//tensorflow/python:embedding_ops", - "//tensorflow/python:framework", - "//tensorflow/python:math_ops", - "//tensorflow/python:platform", - "//tensorflow/python:platform_test", - "//tensorflow/python:client_testlib", - "//third_party/py/numpy", - ], -) - -cuda_py_test( - name = "adam_test", - size = "small", - srcs = ["optimizer_v2/adam_test.py"], - additional_deps = [ - ":optimizer_v2", - "//tensorflow/python:array_ops", - "//tensorflow/python:framework", - "//tensorflow/python:math_ops", - "//tensorflow/python:platform", - "//tensorflow/python:platform_test", - "//tensorflow/python:client_testlib", - "//third_party/py/numpy", - ], -) - -cuda_py_test( - name = "checkpointable_utils_test", - srcs = ["optimizer_v2/checkpointable_utils_test.py"], - additional_deps = [ - ":optimizer_v2", - "@six_archive//:six", - "//tensorflow/python:constant_op", - "//tensorflow/python:dtypes", - "//tensorflow/python:framework_ops", - "//tensorflow/python:framework_test_lib", - "//tensorflow/python:init_ops", - "//tensorflow/python:layers", - "//tensorflow/python:layers_base", - "//tensorflow/python:resource_variable_ops", - "//tensorflow/python:state_ops", - "//tensorflow/python:training", - "//tensorflow/python:variable_scope", - "//tensorflow/python:variables", - "//tensorflow/python/eager:context", - "//tensorflow/python/eager:test", - "//tensorflow/python/keras", - ], - tags = ["notsan"], -) - -cuda_py_test( - name = "sgd_test", - size = "medium", - srcs = ["optimizer_v2/sgd_test.py"], - additional_deps = [ - ":optimizer_v2", - "//tensorflow/python:client_testlib", - "//tensorflow/python:embedding_ops", - "//tensorflow/python:platform_test", - "//tensorflow/python:framework", - "//tensorflow/python:math_ops", - "//tensorflow/python:resource_variable_ops", - "//tensorflow/python:resources", - "//tensorflow/python:variables", - "//tensorflow/python/eager:context", - ], -) - -cuda_py_test( - name = "optimizer_v2_test", - size = "medium", - srcs = ["optimizer_v2/optimizer_v2_test.py"], - additional_deps = [ - ":optimizer_v2", - "//tensorflow/python:client_testlib", - "//tensorflow/python:framework", - "//tensorflow/python:framework_test_lib", - "//tensorflow/python:array_ops", - "//tensorflow/python:clip_ops", - "//tensorflow/python:gradients", - "//tensorflow/python:resource_variable_ops", - "//tensorflow/python:state_ops", - "//tensorflow/python:variables", - ], -) - -cuda_py_test( - name = "rmsprop_test", - size = "small", - srcs = ["optimizer_v2/rmsprop_test.py"], - additional_deps = [ - ":optimizer_v2", - "@absl_py//absl/testing:parameterized", - "//tensorflow/python:array_ops", - "//tensorflow/python:embedding_ops", - "//tensorflow/python:framework", - "//tensorflow/python:math_ops", - "//tensorflow/python:platform", - "//tensorflow/python:platform_test", - "//tensorflow/python:client_testlib", - "//third_party/py/numpy", - ], - tags = ["optonly"], -) diff --git a/tensorflow/python/keras/optimizer_v2/BUILD b/tensorflow/python/keras/optimizer_v2/BUILD new file mode 100644 index 00000000000..292c717e369 --- /dev/null +++ b/tensorflow/python/keras/optimizer_v2/BUILD @@ -0,0 +1,164 @@ +# Description: +# Contains the Keras OptimizerV2 API (internal TensorFlow version). + +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) # Apache 2.0 + +exports_files(["LICENSE"]) + +load("//tensorflow:tensorflow.bzl", "cuda_py_test") + +py_library( + name = "optimizer_v2", + srcs = [ + "adadelta.py", + "adagrad.py", + "adam.py", + "optimizer_v2.py", + "rmsprop.py", + "sgd.py", + ], + srcs_version = "PY2AND3", + deps = [ + "//tensorflow/python:control_flow_ops", + "//tensorflow/python:distribute", + "//tensorflow/python:framework", + "//tensorflow/python:math_ops", + "//tensorflow/python:resource_variable_ops", + "//tensorflow/python:state_ops", + "//tensorflow/python:training", + "//tensorflow/python:variable_scope", + "//tensorflow/python:variables", + ], +) + +cuda_py_test( + name = "adadelta_test", + size = "medium", + srcs = ["adadelta_test.py"], + additional_deps = [ + ":optimizer_v2", + "//tensorflow/python:client_testlib", + "//tensorflow/python:embedding_ops", + "//tensorflow/python:framework", + "//tensorflow/python:math_ops", + "//tensorflow/python:platform", + "//tensorflow/python:platform_test", + "//tensorflow/python:resource_variable_ops", + "//tensorflow/python:variables", + "//third_party/py/numpy", + ], +) + +cuda_py_test( + name = "adagrad_test", + size = "small", + srcs = ["adagrad_test.py"], + additional_deps = [ + ":optimizer_v2", + "//tensorflow/python:embedding_ops", + "//tensorflow/python:framework", + "//tensorflow/python:math_ops", + "//tensorflow/python:platform", + "//tensorflow/python:platform_test", + "//tensorflow/python:client_testlib", + "//third_party/py/numpy", + ], +) + +cuda_py_test( + name = "adam_test", + size = "small", + srcs = ["adam_test.py"], + additional_deps = [ + ":optimizer_v2", + "//tensorflow/python:array_ops", + "//tensorflow/python:framework", + "//tensorflow/python:math_ops", + "//tensorflow/python:platform", + "//tensorflow/python:platform_test", + "//tensorflow/python:client_testlib", + "//third_party/py/numpy", + ], +) + +cuda_py_test( + name = "checkpointable_utils_test", + srcs = ["checkpointable_utils_test.py"], + additional_deps = [ + ":optimizer_v2", + "@six_archive//:six", + "//tensorflow/python:constant_op", + "//tensorflow/python:dtypes", + "//tensorflow/python:framework_ops", + "//tensorflow/python:framework_test_lib", + "//tensorflow/python:init_ops", + "//tensorflow/python:layers", + "//tensorflow/python:layers_base", + "//tensorflow/python:resource_variable_ops", + "//tensorflow/python:state_ops", + "//tensorflow/python:training", + "//tensorflow/python:variable_scope", + "//tensorflow/python:variables", + "//tensorflow/python/eager:context", + "//tensorflow/python/eager:test", + "//tensorflow/python/keras", + ], + tags = ["notsan"], +) + +cuda_py_test( + name = "sgd_test", + size = "medium", + srcs = ["sgd_test.py"], + additional_deps = [ + ":optimizer_v2", + "//tensorflow/python:client_testlib", + "//tensorflow/python:embedding_ops", + "//tensorflow/python:platform_test", + "//tensorflow/python:framework", + "//tensorflow/python:math_ops", + "//tensorflow/python:resource_variable_ops", + "//tensorflow/python:resources", + "//tensorflow/python:variables", + "//tensorflow/python/eager:context", + ], +) + +cuda_py_test( + name = "optimizer_v2_test", + size = "medium", + srcs = ["optimizer_v2_test.py"], + additional_deps = [ + ":optimizer_v2", + "//tensorflow/python:client_testlib", + "//tensorflow/python:framework", + "//tensorflow/python:framework_test_lib", + "//tensorflow/python:array_ops", + "//tensorflow/python:clip_ops", + "//tensorflow/python:gradients", + "//tensorflow/python:resource_variable_ops", + "//tensorflow/python:state_ops", + "//tensorflow/python:variables", + ], +) + +cuda_py_test( + name = "rmsprop_test", + size = "small", + srcs = ["rmsprop_test.py"], + additional_deps = [ + ":optimizer_v2", + "@absl_py//absl/testing:parameterized", + "//tensorflow/python:array_ops", + "//tensorflow/python:embedding_ops", + "//tensorflow/python:framework", + "//tensorflow/python:math_ops", + "//tensorflow/python:platform", + "//tensorflow/python:platform_test", + "//tensorflow/python:client_testlib", + "//third_party/py/numpy", + ], + tags = ["optonly"], +)