tensorflow/tensorflow

View on GitHub
tensorflow/python/ops/special_math_ops_test.py

Summary

Maintainability
F
1 mo
Test Coverage

File special_math_ops_test.py has 898 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2016 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/ops/special_math_ops_test.py - About 2 days to fix

    Function benchmark_einsum has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      def benchmark_einsum(self):
        for equation, dim in self.cases:
          with ops.Graph().as_default(), \
              session.Session(config=benchmark.benchmark_config()) as sess, \
              ops.device('/cpu:0'):
    Severity: Minor
    Found in tensorflow/python/ops/special_math_ops_test.py - About 55 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

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

    @test_util.run_all_in_graph_and_eager_modes
    class FresnelCosTest(test.TestCase, parameterized.TestCase):
    
      @test_util.run_in_graph_and_eager_modes
      def test_fresnel_cos_boundary(self):
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 4 days to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 308..350

    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 452.

    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.run_all_in_graph_and_eager_modes
    class FresnelSinTest(test.TestCase, parameterized.TestCase):
    
      @test_util.run_in_graph_and_eager_modes
      def test_fresnel_sin_boundary(self):
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 4 days to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 263..305

    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 452.

    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

      @test_util.run_in_graph_and_eager_modes
      def test_besselk_boundary(self):
        self.assertTrue(np.isinf(self.evaluate(special_math_ops.bessel_k0(0.))))
        self.assertTrue(np.isinf(self.evaluate(special_math_ops.bessel_k0e(0.))))
        self.assertTrue(np.isinf(self.evaluate(special_math_ops.bessel_k1(0.))))
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 2 days to fix
    tensorflow/python/ops/weak_tensor_special_math_ops_test.py on lines 332..343

    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 234.

    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

      @parameterized.parameters(np.float32, np.float64)
      def test_besselk_larger(self, dtype):
        x = np.random.uniform(1., 30., size=int(1e4)).astype(dtype)
        try:
          from scipy import special  # pylint: disable=g-import-not-at-top
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 1 day to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 467..481

    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 191.

    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

      @parameterized.parameters(np.float32, np.float64)
      def test_besseli_small(self, dtype):
        x = np.random.uniform(-1., 1., size=int(1e4)).astype(dtype)
        try:
          from scipy import special  # pylint: disable=g-import-not-at-top
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 1 day to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 547..561

    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 191.

    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

      @test_util.run_in_graph_and_eager_modes
      def test_besseli_boundary(self):
        self.assertAllClose(1., special_math_ops.bessel_i0(0.))
        self.assertAllClose(1., special_math_ops.bessel_i0e(0.))
        self.assertAllClose(0., special_math_ops.bessel_i1(0.))
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 1 day to fix
    tensorflow/python/ops/weak_tensor_special_math_ops_test.py on lines 312..323

    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 190.

    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 test_besseli_gradient(self):
        inputs = [np.random.uniform(-10., 10., size=int(1e2))]
        analytical, numerical = gradient_checker_v2.compute_gradient(
            special_math_ops.bessel_i0, inputs)
        self.assertLess(gradient_checker_v2.max_error(analytical, numerical), 1e-3)
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 1 day to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 603..619

    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 166.

    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 test_besselk_gradient(self):
        inputs = [np.random.uniform(1., 50., size=int(1e2))]
        analytical, numerical = gradient_checker_v2.compute_gradient(
            special_math_ops.bessel_k0, inputs)
        self.assertLess(gradient_checker_v2.max_error(analytical, numerical), 1e-4)
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 1 day to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 575..591

    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 166.

    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

      @test_util.disable_xla('b/131919749')
      def test_unary_ellipsis(self):
        self._check_gradient('...->...', ())
        self._check_gradient('...->', ())
        self._check_gradient('->...', ())
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 1 day to fix
    tensorflow/python/kernel_tests/linalg/einsum_op_test.py on lines 319..334

    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 164.

    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 test_binary_simple(self):
        # Binary cases in XLA mode must have either (a) each index appearing
        # exactly once in both the inputs (batch or contraction index), or
        # (b) appearing exactly once in an input and in the output (free index).
        self._check_gradient(',->', (), ())
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 2 other locations - About 1 day to fix
    tensorflow/python/kernel_tests/linalg/einsum_op_test.py on lines 93..106
    tensorflow/python/kernel_tests/linalg/einsum_op_test.py on lines 336..349

    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 152.

    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/131919749')
      def test_long_cases_with_repeated_labels(self):
        cases = [
            # Tests from dask.
            'fdf,cdd,ccd,afe->ae',
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 1 day to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 1041..1054

    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 140.

    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 test_long_cases(self):
        cases = [
            'abhe,hidj,jgba,hiab,gab->ed',
            # Tests from dask.
            'ea,fb,abcd,gc,hd->efgh',
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 1 day to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 1056..1070

    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 140.

    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

      @parameterized.parameters(np.float32, np.float64)
      def test_besseli_larger(self, dtype):
        x = np.random.uniform(1., 20., size=int(1e4)).astype(dtype)
        try:
          from scipy import special  # pylint: disable=g-import-not-at-top
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 3 other locations - About 1 day to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 483..493
    tensorflow/python/ops/special_math_ops_test.py on lines 535..545
    tensorflow/python/ops/special_math_ops_test.py on lines 563..573

    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 135.

    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

      @parameterized.parameters(np.float32, np.float64)
      def test_besselj_small(self, dtype):
        x = np.random.uniform(-1., 1., size=int(1e4)).astype(dtype)
        try:
          from scipy import special  # pylint: disable=g-import-not-at-top
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 3 other locations - About 1 day to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 523..533
    tensorflow/python/ops/special_math_ops_test.py on lines 535..545
    tensorflow/python/ops/special_math_ops_test.py on lines 563..573

    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 135.

    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

      @parameterized.parameters(np.float32, np.float64)
      def test_bessely_larger(self, dtype):
        x = np.random.uniform(1., 30., size=int(1e4)).astype(dtype)
        try:
          from scipy import special  # pylint: disable=g-import-not-at-top
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 3 other locations - About 1 day to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 483..493
    tensorflow/python/ops/special_math_ops_test.py on lines 523..533
    tensorflow/python/ops/special_math_ops_test.py on lines 535..545

    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 135.

    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

      @test_util.run_in_graph_and_eager_modes
      def test_spence_boundary(self):
        self.assertAllClose(np.pi**2 / 6., special_math_ops.spence(0.))
        self.assertAllClose(0., special_math_ops.spence(1.))
        self.assertTrue(np.isnan(self.evaluate(special_math_ops.spence(np.nan))))
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 1 day to fix
    tensorflow/python/ops/weak_tensor_special_math_ops_test.py on lines 257..268

    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 135.

    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

      @parameterized.parameters(np.float32, np.float64)
      def test_besselj_larger(self, dtype):
        x = np.random.uniform(1., 30., size=int(1e4)).astype(dtype)
        try:
          from scipy import special  # pylint: disable=g-import-not-at-top
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 3 other locations - About 1 day to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 483..493
    tensorflow/python/ops/special_math_ops_test.py on lines 523..533
    tensorflow/python/ops/special_math_ops_test.py on lines 563..573

    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 135.

    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

      @test_util.run_in_graph_and_eager_modes
      def test_expint_boundary(self):
        self.assertAllClose(-np.inf, special_math_ops.expint(0.))
        self.assertTrue(np.isnan(self.evaluate(special_math_ops.expint(np.nan))))
        # Check that the domain of definition is [0, inf)
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 7 hrs to fix
    tensorflow/python/ops/weak_tensor_special_math_ops_test.py on lines 92..102

    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 111.

    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

      @parameterized.parameters(np.float32, np.float64)
      def test_dawsn_larger(self, dtype):
        x = np.random.uniform(1., 100., size=int(1e4)).astype(dtype)
        try:
          from scipy import special  # pylint: disable=g-import-not-at-top
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 5 other locations - About 6 hrs to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 194..202
    tensorflow/python/ops/special_math_ops_test.py on lines 236..244
    tensorflow/python/ops/special_math_ops_test.py on lines 246..254
    tensorflow/python/ops/special_math_ops_test.py on lines 369..377
    tensorflow/python/ops/special_math_ops_test.py on lines 379..387

    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 107.

    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

      @parameterized.parameters(np.float32, np.float64)
      def test_expint_larger(self, dtype):
        x = np.random.uniform(1., 50., size=int(1e4)).astype(dtype)
        try:
          from scipy import special  # pylint: disable=g-import-not-at-top
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 5 other locations - About 6 hrs to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 194..202
    tensorflow/python/ops/special_math_ops_test.py on lines 204..212
    tensorflow/python/ops/special_math_ops_test.py on lines 236..244
    tensorflow/python/ops/special_math_ops_test.py on lines 369..377
    tensorflow/python/ops/special_math_ops_test.py on lines 379..387

    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 107.

    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

      @parameterized.parameters(np.float32, np.float64)
      def test_spence_small(self, dtype):
        x = np.random.uniform(0., 1., size=int(1e4)).astype(dtype)
        try:
          from scipy import special  # pylint: disable=g-import-not-at-top
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 5 other locations - About 6 hrs to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 194..202
    tensorflow/python/ops/special_math_ops_test.py on lines 204..212
    tensorflow/python/ops/special_math_ops_test.py on lines 236..244
    tensorflow/python/ops/special_math_ops_test.py on lines 246..254
    tensorflow/python/ops/special_math_ops_test.py on lines 379..387

    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 107.

    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

      @parameterized.parameters(np.float32, np.float64)
      def test_expint_small(self, dtype):
        x = np.random.uniform(0., 1., size=int(1e4)).astype(dtype)
        try:
          from scipy import special  # pylint: disable=g-import-not-at-top
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 5 other locations - About 6 hrs to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 194..202
    tensorflow/python/ops/special_math_ops_test.py on lines 204..212
    tensorflow/python/ops/special_math_ops_test.py on lines 246..254
    tensorflow/python/ops/special_math_ops_test.py on lines 369..377
    tensorflow/python/ops/special_math_ops_test.py on lines 379..387

    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 107.

    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

      @parameterized.parameters(np.float32, np.float64)
      def test_spence_larger(self, dtype):
        x = np.random.uniform(1., 100., size=int(1e4)).astype(dtype)
        try:
          from scipy import special  # pylint: disable=g-import-not-at-top
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 5 other locations - About 6 hrs to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 194..202
    tensorflow/python/ops/special_math_ops_test.py on lines 204..212
    tensorflow/python/ops/special_math_ops_test.py on lines 236..244
    tensorflow/python/ops/special_math_ops_test.py on lines 246..254
    tensorflow/python/ops/special_math_ops_test.py on lines 369..377

    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 107.

    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

      @parameterized.parameters(np.float32, np.float64)
      def test_dawsn_small(self, dtype):
        x = np.random.uniform(-1., 1., size=int(1e4)).astype(dtype)
        try:
          from scipy import special  # pylint: disable=g-import-not-at-top
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 5 other locations - About 6 hrs to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 204..212
    tensorflow/python/ops/special_math_ops_test.py on lines 236..244
    tensorflow/python/ops/special_math_ops_test.py on lines 246..254
    tensorflow/python/ops/special_math_ops_test.py on lines 369..377
    tensorflow/python/ops/special_math_ops_test.py on lines 379..387

    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 107.

    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

      @test_util.run_in_graph_and_eager_modes
      def test_besselj_boundary(self):
        self.assertAllClose(1., special_math_ops.bessel_j0(0.))
        self.assertAllClose(0., special_math_ops.bessel_j1(0.))
        self.assertTrue(np.isnan(self.evaluate(special_math_ops.bessel_j0(np.nan))))
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 6 hrs to fix
    tensorflow/python/ops/weak_tensor_special_math_ops_test.py on lines 325..330

    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 100.

    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 test_bessely_gradient(self):
        inputs = [np.random.uniform(1., 50., size=int(1e2))]
        analytical, numerical = gradient_checker_v2.compute_gradient(
            special_math_ops.bessel_y0, inputs)
        self.assertLess(gradient_checker_v2.max_error(analytical, numerical), 1e-4)
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 6 hrs to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 593..601

    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 98.

    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 test_besselj_gradient(self):
        inputs = [np.random.uniform(-50., 50., size=int(1e2))]
        analytical, numerical = gradient_checker_v2.compute_gradient(
            special_math_ops.bessel_j0, inputs)
        self.assertLess(gradient_checker_v2.max_error(analytical, numerical), 1e-4)
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 6 hrs to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 621..629

    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 98.

    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

      @test_util.disable_xla('b/131919749')
      def test_repeated_indices(self):
        # Repeated indices.
        self._check_gradient('aba,a->b', (3, 4, 3), (3,))
        self._check_gradient('ijj,k->ik', (2, 3, 3), (4,))
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 5 hrs to fix
    tensorflow/python/kernel_tests/linalg/einsum_op_test.py on lines 364..371

    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 89.

    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 test_repeated_indices(self):
        # Repeated indices.
        self._check('ijj,k->ik', (2, 3, 3), (4,))
        self._check('aba,a->b', (3, 4, 3), (3,))
        # From https://github.com/dask/dask/pull/3412#discussion_r182413444
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 4 hrs to fix
    tensorflow/python/kernel_tests/linalg/einsum_op_test.py on lines 113..119

    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 77.

    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

      @test_util.disable_xla('b/131919749')
      def test_empty_with_repeated_indices(self):
        self._check_gradient('aab,bc->ac', (0, 0, 10), (10, 10))
        self._check_gradient('aab,bc->ac', (1, 1, 0), (0, 10))
        self._check_gradient('aaab,bc->c', (0, 0, 0, 3), (3, 4))
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 2 hrs to fix
    tensorflow/python/kernel_tests/linalg/einsum_op_test.py on lines 373..376

    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 56.

    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/131919749')
      def test_reduced_indices(self):
        self._check_gradient('ba,b->', (3, 2), (3,))
        self._check_gradient('ab,ab->', (3, 4), (3, 4))
        self._check_gradient('abce,badf->abcd', (1, 2, 3, 4), (2, 1, 4, 3))
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 2 hrs to fix
    tensorflow/python/kernel_tests/linalg/einsum_op_test.py on lines 108..111

    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 55.

    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 subscript in input_subscripts:
              input_shape = (dim,) * len(subscript)
              input_vars.append(
                  variables.Variable(np.array(r.randn(*input_shape), np.float32)))
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 2 hrs to fix
    tensorflow/python/kernel_tests/linalg/einsum_op_test.py on lines 426..429

    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 53.

    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 actual_shape, placeholder_shape in input_and_placeholder_shapes:
            input_np = np.array(r.randn(*actual_shape))
            inputs.append(input_np)
            input_placeholders.append(
                array_ops.placeholder_with_default(input_np, placeholder_shape))
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 1 hr to fix
    tensorflow/python/kernel_tests/linalg/einsum_op_test.py on lines 220..225

    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 43.

    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 test_spence_gradient_at_one(self):
        analytical, _ = gradient_checker_v2.compute_gradient(
            special_math_ops.spence, [1.])
        self.assertAllClose([[[-1.]]], analytical)
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 1 hr to fix
    tensorflow/python/ops/weak_tensor_special_math_ops_test.py on lines 303..306

    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 41.

    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

        dimension_map = dict((c, ord(c) - ord('a') + 1) for c in 'abcdefghij')
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 1 hr to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 830..830

    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 40.

    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

        dimension_map = dict((c, ord(c) - ord('a') + 1) for c in 'abcdefghij')
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 1 hr to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 881..881

    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 40.

    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

        self.assertAllClose(
            self.evaluate(special_math_ops.bessel_i0e(x)),
            self.evaluate(special_math_ops.bessel_i0e(-x)))
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 5 other locations - About 1 hr to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 440..442
    tensorflow/python/ops/special_math_ops_test.py on lines 448..450
    tensorflow/python/ops/weak_tensor_special_math_ops_test.py on lines 350..352
    tensorflow/python/ops/weak_tensor_special_math_ops_test.py on lines 354..356
    tensorflow/python/ops/weak_tensor_special_math_ops_test.py on lines 358..360

    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 38.

    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

        self.assertAllClose(
            self.evaluate(special_math_ops.bessel_i0(x)),
            self.evaluate(special_math_ops.bessel_i0(-x)))
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 5 other locations - About 1 hr to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 444..446
    tensorflow/python/ops/special_math_ops_test.py on lines 448..450
    tensorflow/python/ops/weak_tensor_special_math_ops_test.py on lines 350..352
    tensorflow/python/ops/weak_tensor_special_math_ops_test.py on lines 354..356
    tensorflow/python/ops/weak_tensor_special_math_ops_test.py on lines 358..360

    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 38.

    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

        self.assertAllClose(
            self.evaluate(special_math_ops.bessel_j0(x)),
            self.evaluate(special_math_ops.bessel_j0(-x)))
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 5 other locations - About 1 hr to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 440..442
    tensorflow/python/ops/special_math_ops_test.py on lines 444..446
    tensorflow/python/ops/weak_tensor_special_math_ops_test.py on lines 350..352
    tensorflow/python/ops/weak_tensor_special_math_ops_test.py on lines 354..356
    tensorflow/python/ops/weak_tensor_special_math_ops_test.py on lines 358..360

    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 38.

    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 4 locations. Consider refactoring.
    Open

        x = np.random.uniform(np.finfo(dtype).eps, 1., size=int(1e4)).astype(dtype)
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 3 other locations - About 50 mins to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 497..497
    tensorflow/python/ops/weak_tensor_special_math_ops_test.py on lines 420..420
    tensorflow/python/ops/weak_tensor_special_math_ops_test.py on lines 443..443

    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

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

        x = np.random.uniform(np.finfo(dtype).eps, 1., size=int(1e4)).astype(dtype)
    Severity: Major
    Found in tensorflow/python/ops/special_math_ops_test.py and 3 other locations - About 50 mins to fix
    tensorflow/python/ops/special_math_ops_test.py on lines 513..513
    tensorflow/python/ops/weak_tensor_special_math_ops_test.py on lines 420..420
    tensorflow/python/ops/weak_tensor_special_math_ops_test.py on lines 443..443

    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

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

        check('bijl,bjkm->bik', ((9, 2, 3, 5), (None, None, None, 5)),
              ((9, 3, 4, 7), (None, None, 4, None)))
    Severity: Minor
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 45 mins to fix
    tensorflow/python/kernel_tests/linalg/einsum_op_test.py on lines 231..232

    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 35.

    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

            if len(input_vars) <= 2:
              self.run_op_benchmark(
                  sess,
                  special_math_ops.einsum(equation, *input_vars),
                  min_iters=50,
    Severity: Minor
    Found in tensorflow/python/ops/special_math_ops_test.py and 1 other location - About 30 mins to fix
    tensorflow/python/kernel_tests/linalg/einsum_op_test.py on lines 433..437

    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 32.

    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