tensorflow/tensorflow

View on GitHub
tensorflow/python/kernel_tests/nn_ops/relu_op_test.py

Summary

Maintainability
F
3 wks
Test Coverage

File relu_op_test.py has 535 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2015 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
Severity: Major
Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py - About 1 day to fix

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

      def testGradGradFloat32(self):
        with self.cached_session():
    
          def f(x):
            assert x.dtype == dtypes.float32
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 2 other locations - About 1 day to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 168..184
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 578..594

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 148.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

      def testGradGradFloat32(self):
        with self.cached_session():
    
          def f(x):
            assert x.dtype == dtypes.float32
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 2 other locations - About 1 day to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 150..166
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 168..184

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 148.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

      def testGradGradFloat64(self):
        with self.cached_session():
    
          def f(x):
            assert x.dtype == dtypes.float64
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 2 other locations - About 1 day to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 150..166
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 578..594

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 148.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

      def testGradGradFloat32(self):
        with self.cached_session():
    
          def f(x):
            assert x.dtype == dtypes.float32
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 6 other locations - About 1 day to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 373..389
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 492..508
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 510..526
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 596..612
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3666..3684
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3723..3741

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 138.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

      def testGradGradFloat64(self):
        with self.cached_session():
    
          def f(x):
            assert x.dtype == dtypes.float64
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 6 other locations - About 1 day to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 355..371
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 373..389
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 492..508
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 596..612
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3666..3684
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3723..3741

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 138.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

      def testGradGradFloat32(self):
        with self.cached_session():
    
          def f(x):
            assert x.dtype == dtypes.float32
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 6 other locations - About 1 day to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 355..371
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 373..389
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 510..526
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 596..612
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3666..3684
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3723..3741

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 138.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

      def testGradGradFloat64(self):
        with self.cached_session():
    
          def f(x):
            assert x.dtype == dtypes.float64
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 6 other locations - About 1 day to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 355..371
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 492..508
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 510..526
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 596..612
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3666..3684
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3723..3741

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 138.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 7 locations. Consider refactoring.
    Open

      def testGradGradFloat64(self):
        with self.cached_session():
    
          def f(x):
            assert x.dtype == dtypes.float64
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 6 other locations - About 1 day to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 355..371
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 373..389
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 492..508
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 510..526
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3666..3684
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3723..3741

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 138.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      def testGradientFloat32(self):
        with self.cached_session():
          x = np.asarray(
              [[-0.9, -0.7, -0.5, -0.3, -0.1], [0.1, 0.3, 0.5, 0.7, 0.9]],
              dtype=np.float32,
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 1 other location - About 5 hrs to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 140..148

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 91.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      def testGradientFloat64(self):
        with self.cached_session():
          x = np.asarray(
              [[-0.9, -0.7, -0.5, -0.3, -0.1], [0.1, 0.3, 0.5, 0.7, 0.9]],
              dtype=np.float64,
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 1 other location - About 5 hrs to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 118..126

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 91.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

      def testGradientFloat64(self):
        with self.cached_session():
          x_val = [[-0.9, -0.7, -0.5, -0.3, -0.1], [0.1, 0.3, 0.5, 0.7, 0.9]]
          x = np.asarray(x_val, dtype=np.float64, order="F")
          err = gradient_checker_v2.max_error(
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 2 other locations - About 5 hrs to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 460..466
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 468..474

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 86.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

      def testGradientFloat64(self):
        with self.cached_session():
          x_val = [[-0.9, -0.7, -0.5, -0.3, -0.1], [0.1, 0.3, 0.5, 0.7, 0.9]]
          x = np.asarray(x_val, dtype=np.float64, order="F")
          err = gradient_checker_v2.max_error(
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 2 other locations - About 5 hrs to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 460..466
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 570..576

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 86.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

      def testGradientFloat32(self):
        with self.cached_session():
          x_val = [[-0.9, -0.7, -0.5, -0.3, -0.1], [0.1, 0.3, 0.5, 0.7, 0.9]]
          x = np.asarray(x_val, dtype=np.float32, order="F")
          err = gradient_checker_v2.max_error(
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 2 other locations - About 5 hrs to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 468..474
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 570..576

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 86.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

      def testNumbersGPU(self):
        if not test.is_gpu_available():
          self.skipTest("No GPU available")
        for t in [
            np.float16,
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 3 other locations - About 4 hrs to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 68..78
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 242..252
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 445..454

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 84.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

      def testNumbersGPU(self):
        if not test.is_gpu_available():
          self.skipTest("No GPU available")
        for t in [
            np.float16,
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 3 other locations - About 4 hrs to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 68..78
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 445..454
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 643..653

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 84.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

      def testNumbersGPU(self):
        if not test.is_gpu_available():
          self.skipTest("No GPU available")
        for t in [
            np.float16,
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 3 other locations - About 4 hrs to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 242..252
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 445..454
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 643..653

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 84.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

      def testNumbersGPU(self):
        if not test.is_gpu_available():
          self.skipTest("No GPU available")
        for t in [
            np.float16,
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 3 other locations - About 4 hrs to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 68..78
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 242..252
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 643..653

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 84.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 10 locations. Consider refactoring.
    Open

      def testGradientFloat16(self):
        with self.cached_session():
          x = np.asarray(
              [[-0.9, -0.7, -0.5, -0.3, -0.1], [0.1, 0.3, 0.5, 0.7, 0.9]],
              dtype=np.float16,
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 9 other locations - About 4 hrs to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 262..270
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 272..280
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 335..343
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 345..353
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3699..3709
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3711..3721
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3870..3880
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3882..3892
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3894..3904

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 81.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 10 locations. Consider refactoring.
    Open

      def testGradientFloat32(self):
        with self.cached_session():
          x = np.asarray(
              [[-0.9, -0.7, -0.5, -0.3, -0.1], [0.1, 0.3, 0.5, 0.7, 0.9]],
              dtype=np.float32,
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 9 other locations - About 4 hrs to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 130..138
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 262..270
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 272..280
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 345..353
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3699..3709
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3711..3721
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3870..3880
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3882..3892
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3894..3904

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 81.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 10 locations. Consider refactoring.
    Open

      def testGradientFloat32(self):
        with self.cached_session():
          x = np.asarray(
              [[-0.9, -0.7, -0.5, -0.3, -0.1], [6.1, 6.3, 6.5, 6.7, 6.9]],
              dtype=np.float32,
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 9 other locations - About 4 hrs to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 130..138
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 272..280
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 335..343
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 345..353
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3699..3709
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3711..3721
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3870..3880
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3882..3892
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3894..3904

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 81.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 10 locations. Consider refactoring.
    Open

      def testGradientFloat64(self):
        with self.cached_session():
          x = np.asarray(
              [[-0.9, -0.7, -0.5, -0.3, -0.1], [0.1, 0.3, 0.5, 0.7, 0.9]],
              dtype=np.float64,
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 9 other locations - About 4 hrs to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 130..138
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 262..270
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 272..280
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 335..343
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3699..3709
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3711..3721
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3870..3880
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3882..3892
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3894..3904

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 81.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 10 locations. Consider refactoring.
    Open

      def testGradientFloat64(self):
        with self.cached_session():
          x = np.asarray(
              [[-0.9, -0.7, -0.5, -0.3, -0.1], [6.1, 6.3, 6.5, 6.7, 6.9]],
              dtype=np.float64,
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 9 other locations - About 4 hrs to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 130..138
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 262..270
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 335..343
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 345..353
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3699..3709
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3711..3721
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3870..3880
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3882..3892
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3894..3904

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 81.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

      def testNumbersCPU(self):
        for t in [
            np.int32, np.int64, np.float16, np.float32, np.float64,
            dtypes.bfloat16.as_numpy_dtype
        ]:
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 2 other locations - About 4 hrs to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 58..66
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 232..240

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 79.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

      def testNumbersCPU(self):
        for t in [
            np.int32, np.int64, np.float16, np.float32, np.float64,
            dtypes.bfloat16.as_numpy_dtype
        ]:
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 2 other locations - About 4 hrs to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 58..66
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 633..641

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 79.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

      def testNumbersCPU(self):
        for t in [
            np.int32, np.int64, np.float16, np.float32, np.float64,
            dtypes.bfloat16.as_numpy_dtype
        ]:
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 2 other locations - About 4 hrs to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 232..240
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 633..641

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 79.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

      def testNpLeakyRelu(self):
        self.assertAllClose(
            np.array([[-0.09, 0.7, -0.05, 0.3, -0.01],
                      [0.1, -0.03, 0.5, -0.07, 0.9]]),
            self._npLeakyRelu(
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 1 other location - About 3 hrs to fix
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3630..3637

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 68.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 6 locations. Consider refactoring.
    Open

      def testNpRelu(self):
        self.assertAllClose(
            np.array([[0.0, 0.7, 0.0, 0.3, 0.0], [0.1, 0.0, 0.5, 0.0, 0.9]]),
            self._npRelu(
                np.array([[-0.9, 0.7, -0.5, 0.3, -0.1], [0.1, -0.3, 0.5, -0.7,
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 5 other locations - About 3 hrs to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 219..224
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 422..428
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 537..543
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3749..3754
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3836..3840

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 64.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 6 locations. Consider refactoring.
    Open

      def testNpRelu6(self):
        self.assertAllClose(
            np.array([[0.0, 0.7, 0.0, 0.3, 6.0], [0.1, 0.0, 6.0, 0.0, 0.9]]),
            self._npRelu6(
                np.array([[-0.9, 0.7, -0.5, 0.3, 6.0], [0.1, -0.3, 6.5, -0.7,
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 5 other locations - About 3 hrs to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 45..50
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 422..428
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 537..543
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3749..3754
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3836..3840

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 64.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 6 locations. Consider refactoring.
    Open

      def testNpElu(self):
        self.assertAllClose(
            np.array([[-0.59343034025, 0.7, -0.39346934028, 0.3, -0.09516258196],
                      [0.1, -0.25918177931, 0.5, -0.5034146962, 0.9]]),
            self._npElu(
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 5 other locations - About 3 hrs to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 45..50
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 219..224
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 537..543
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3749..3754
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3836..3840

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 64.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 6 locations. Consider refactoring.
    Open

      def testNpSelu(self):
        self.assertAllClose(
            np.array([[-1.0433095, 0.73549069, -0.6917582, 0.3152103, -0.16730527],
                      [0.1050701, -0.45566732, 0.5253505, -0.88505305, 0.9456309]]),
            self._npSelu(
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 5 other locations - About 3 hrs to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 45..50
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 219..224
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 422..428
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3749..3754
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3836..3840

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 64.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

      def _npRelu6(self, np_features):
        sixes = np.copy(np_features)
        sixes.fill(6.0)
        return np.minimum(
            np.maximum(np_features, np.zeros(np_features.shape)), sixes)
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 1 other location - About 2 hrs to fix
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3829..3833

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 52.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      def _testLeakyRelu(self, np_features, alpha):
        np_leaky_relu = self._npLeakyRelu(np_features, alpha)
        tf_leaky_relu = nn_ops.leaky_relu(np_features, alpha)
        self.assertAllCloseAccordingToType(np_leaky_relu, tf_leaky_relu)
        self.assertShapeEqual(np_leaky_relu, tf_leaky_relu)
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 1 other location - About 2 hrs to fix
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3643..3647

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 52.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        for t in [
            np.int32, np.int64, np.float16, np.float32, np.float64,
            dtypes.bfloat16.as_numpy_dtype
        ]:
          # Force execution on CPU even if a GPU kernel is available for the type.
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 1 other location - About 2 hrs to fix
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3650..3654

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 50.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 6 locations. Consider refactoring.
    Open

      def _testSelu(self, np_features):
        np_selu = self._npSelu(np_features)
        tf_selu = nn_ops.selu(np_features)
        self.assertAllCloseAccordingToType(np_selu, tf_selu)
        self.assertShapeEqual(np_selu, tf_selu)
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 5 other locations - About 1 hr to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 52..56
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 226..230
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 430..434
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3759..3763
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3844..3848

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 49.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 6 locations. Consider refactoring.
    Open

      def _testElu(self, np_features):
        np_elu = self._npElu(np_features)
        tf_elu = nn_ops.elu(np_features)
        self.assertAllCloseAccordingToType(np_elu, tf_elu)
        self.assertShapeEqual(np_elu, tf_elu)
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 5 other locations - About 1 hr to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 52..56
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 226..230
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 545..549
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3759..3763
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3844..3848

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 49.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 6 locations. Consider refactoring.
    Open

      def _testRelu(self, np_features):
        np_relu = self._npRelu(np_features)
        tf_relu = nn_ops.relu(np_features)
        self.assertAllClose(np_relu, tf_relu)
        self.assertShapeEqual(np_relu, tf_relu)
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 5 other locations - About 1 hr to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 226..230
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 430..434
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 545..549
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3759..3763
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3844..3848

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 49.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 6 locations. Consider refactoring.
    Open

      def _testRelu6(self, np_features):
        np_relu6 = self._npRelu6(np_features)
        tf_relu6 = nn_ops.relu6(np_features)
        self.assertAllClose(np_relu6, tf_relu6)
        self.assertShapeEqual(np_relu6, tf_relu6)
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 5 other locations - About 1 hr to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 52..56
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 430..434
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 545..549
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3759..3763
    tensorflow/tools/ci_build/osx/arm64/tensorflow_metal_plugin_test.py on lines 3844..3848

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 49.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      def testNaNPropagation(self):
        for t in [np.float16, np.float32, np.float64]:
          self._testElu(np.array([-1, np.nan, 1, np.nan]).astype(t))
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 1 other location - About 1 hr to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 111..114

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 46.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      @test_util.disable_xla("b/157978028: Does not yet pass with XLA")
      def testNaNPropagation(self):
        for t in [np.float16, np.float32, np.float64]:
          self._testRelu(np.array([-1, np.nan, 1, np.nan]).astype(t))
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 1 other location - About 1 hr to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 456..458

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 46.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        tf_crelu = nn_ops.crelu(
            np.array([[-9, 7, -5, 3, -1], [1, -3, 5, -7, 9]]), axis=1)
    Severity: Minor
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 1 other location - About 50 mins to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 656..657

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 36.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        tf_crelu = nn_ops.crelu(
            np.array([[-9, 7, -5, 3, -1], [1, -3, 5, -7, 9]]), axis=0)
    Severity: Minor
    Found in tensorflow/python/kernel_tests/nn_ops/relu_op_test.py and 1 other location - About 50 mins to fix
    tensorflow/python/kernel_tests/nn_ops/relu_op_test.py on lines 663..664

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 36.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status