diff --git a/tensorflow_addons/BUILD b/tensorflow_addons/BUILD index 43e7ae6f63..e2df92782c 100644 --- a/tensorflow_addons/BUILD +++ b/tensorflow_addons/BUILD @@ -13,6 +13,7 @@ py_library( "//tensorflow_addons/image", "//tensorflow_addons/layers", "//tensorflow_addons/losses", + "//tensorflow_addons/metrics", "//tensorflow_addons/optimizers", "//tensorflow_addons/rnn", "//tensorflow_addons/seq2seq", diff --git a/tensorflow_addons/__init__.py b/tensorflow_addons/__init__.py index aae841e757..0e1bf2fa17 100644 --- a/tensorflow_addons/__init__.py +++ b/tensorflow_addons/__init__.py @@ -75,6 +75,7 @@ def _ensure_tf_install(): from tensorflow_addons import image from tensorflow_addons import layers from tensorflow_addons import losses +from tensorflow_addons import metrics from tensorflow_addons import optimizers from tensorflow_addons import rnn from tensorflow_addons import seq2seq diff --git a/tensorflow_addons/metrics/BUILD b/tensorflow_addons/metrics/BUILD new file mode 100644 index 0000000000..93979903a1 --- /dev/null +++ b/tensorflow_addons/metrics/BUILD @@ -0,0 +1,14 @@ +licenses(["notice"]) # Apache 2.0 + +package(default_visibility = ["//visibility:public"]) + +py_library( + name = "metrics", + srcs = [ + "__init__.py", + ], + srcs_version = "PY2AND3", + deps = [ + "//tensorflow_addons/utils", + ], +) diff --git a/tensorflow_addons/metrics/README.md b/tensorflow_addons/metrics/README.md new file mode 100644 index 0000000000..a6ae7ec2e3 --- /dev/null +++ b/tensorflow_addons/metrics/README.md @@ -0,0 +1,32 @@ +# Addons - Metrics + +## Maintainers +| Submodule | Maintainers | Contact Info | +|:---------- |:------------- |:--------------| +| | | | + +## Contents +| Submodule | Activation | Reference | +|:----------------------- |:-------------------|:---------------| +| | | | + + +## Contribution Guidelines +#### Standard API +In order to conform with the current API standard, all metrics +must: + * Inherit from `tf.metrics.Metric`. + * [Register as a keras global object](https://github.com/tensorflow/addons/blob/master/tensorflow_addons/utils/python/keras_utils.py) + so it can be serialized properly. + * Add the addon to the `py_library` in this sub-package's BUILD file. + +#### Testing Requirements + * Simple unittests that demonstrate the metric is behaving as expected. + * When applicable, run all unittests with TensorFlow's + `@run_in_graph_and_eager_modes` (for test method) + or `run_all_in_graph_and_eager_modes` (for TestCase subclass) + decorator. + * Add a `py_test` to this sub-package's BUILD file. + +#### Documentation Requirements + * Update the table of contents in this sub-package's README. diff --git a/tensorflow_addons/metrics/__init__.py b/tensorflow_addons/metrics/__init__.py new file mode 100644 index 0000000000..5ef2f13641 --- /dev/null +++ b/tensorflow_addons/metrics/__init__.py @@ -0,0 +1,19 @@ +# Copyright 2019 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== +"""A module containing metrics that conform to Keras API.""" + +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function