# Path: tf_slim/metrics/classification.py
# def accuracy(predictions, labels, weights=None, name=None):
# def f1_score(labels, predictions, weights=None, num_thresholds=200,
#              metrics_collections=None, updates_collections=None, name=None):
#     def compute_best_f1_score(tp, fp, fn, name):
#     def f1_across_replicas(_, values):


import numpy as np
import tensorflow.compat.v1 as tf
from tf_slim.metrics import classification
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import random_ops
from tensorflow.python.ops import variables
from tensorflow.python.platform import test
# 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.
# ==============================================================================
"""Tests for metrics.classification."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

# pylint: disable=g-direct-tensorflow-import


def setUpModule():
  tf.disable_eager_execution()


class ClassificationTest(test.TestCase):

  def testAccuracy1D(self):
    with self.cached_session() as session:
      pred = array_ops.placeholder(dtypes.int32, shape=[None])
      labels = array_ops.placeholder(dtypes.int32, shape=[None])

# Path: tf_slim/metrics/classification.py
# def accuracy(predictions, labels, weights=None, name=None):
# def f1_score(labels, predictions, weights=None, num_thresholds=200,
#              metrics_collections=None, updates_collections=None, name=None):
#     def compute_best_f1_score(tp, fp, fn, name):
#     def f1_across_replicas(_, values):


# Path: tf_slim/metrics/classification_test.py
import numpy as np
import tensorflow.compat.v1 as tf
from tf_slim.metrics import classification
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import random_ops
from tensorflow.python.ops import variables
from tensorflow.python.platform import test

# 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.
# ==============================================================================
"""Tests for metrics.classification."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

# pylint: disable=g-direct-tensorflow-import


def setUpModule():
  tf.disable_eager_execution()


class ClassificationTest(test.TestCase):

  def testAccuracy1D(self):
    with self.cached_session() as session:
      pred = array_ops.placeholder(dtypes.int32, shape=[None])
      labels = array_ops.placeholder(dtypes.int32, shape=[None])

      acc = classification.accuracy(pred, labels)