Skip to content

Commit d46dba1

Browse files
AakashKumarNainseanpmorgan
authored andcommitted
Add metrics module (#247)
* add Metrics subpackage
1 parent 6c7f559 commit d46dba1

File tree

5 files changed

+67
-0
lines changed

5 files changed

+67
-0
lines changed

tensorflow_addons/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ py_library(
1313
"//tensorflow_addons/image",
1414
"//tensorflow_addons/layers",
1515
"//tensorflow_addons/losses",
16+
"//tensorflow_addons/metrics",
1617
"//tensorflow_addons/optimizers",
1718
"//tensorflow_addons/rnn",
1819
"//tensorflow_addons/seq2seq",

tensorflow_addons/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def _ensure_tf_install():
7575
from tensorflow_addons import image
7676
from tensorflow_addons import layers
7777
from tensorflow_addons import losses
78+
from tensorflow_addons import metrics
7879
from tensorflow_addons import optimizers
7980
from tensorflow_addons import rnn
8081
from tensorflow_addons import seq2seq

tensorflow_addons/metrics/BUILD

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
licenses(["notice"]) # Apache 2.0
2+
3+
package(default_visibility = ["//visibility:public"])
4+
5+
py_library(
6+
name = "metrics",
7+
srcs = [
8+
"__init__.py",
9+
],
10+
srcs_version = "PY2AND3",
11+
deps = [
12+
"//tensorflow_addons/utils",
13+
],
14+
)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Addons - Metrics
2+
3+
## Maintainers
4+
| Submodule | Maintainers | Contact Info |
5+
|:---------- |:------------- |:--------------|
6+
| | | |
7+
8+
## Contents
9+
| Submodule | Activation | Reference |
10+
|:----------------------- |:-------------------|:---------------|
11+
| | | |
12+
13+
14+
## Contribution Guidelines
15+
#### Standard API
16+
In order to conform with the current API standard, all metrics
17+
must:
18+
* Inherit from `tf.metrics.Metric`.
19+
* [Register as a keras global object](https://github.com/tensorflow/addons/blob/master/tensorflow_addons/utils/python/keras_utils.py)
20+
so it can be serialized properly.
21+
* Add the addon to the `py_library` in this sub-package's BUILD file.
22+
23+
#### Testing Requirements
24+
* Simple unittests that demonstrate the metric is behaving as expected.
25+
* When applicable, run all unittests with TensorFlow's
26+
`@run_in_graph_and_eager_modes` (for test method)
27+
or `run_all_in_graph_and_eager_modes` (for TestCase subclass)
28+
decorator.
29+
* Add a `py_test` to this sub-package's BUILD file.
30+
31+
#### Documentation Requirements
32+
* Update the table of contents in this sub-package's README.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
# ==============================================================================
15+
"""A module containing metrics that conform to Keras API."""
16+
17+
from __future__ import absolute_import
18+
from __future__ import division
19+
from __future__ import print_function

0 commit comments

Comments
 (0)