tensorflow/tensorflow

View on GitHub
tensorflow/python/kernel_tests/math_ops/transpose_op_test.py

Summary

Maintainability
F
3 wks
Test Coverage

File transpose_op_test.py has 449 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: Minor
Found in tensorflow/python/kernel_tests/math_ops/transpose_op_test.py - About 6 hrs to fix

    TransposeTest has 34 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class TransposeTest(test.TestCase):
    
      def _np_transpose(self, x, perm):
        ret = np.copy(x)
        ret = ret.transpose(perm)
    Severity: Minor
    Found in tensorflow/python/kernel_tests/math_ops/transpose_op_test.py - About 4 hrs to fix

      Function _compare has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def _compare(self, x, use_gpu=False):
          n = np.ndim(x)
          # generate all permutations of [0, 1, ... n-1] in random order.
          all_perm = np.random.permutation(
              [p for p in itertools.permutations(range(n))]).astype(np.int32)
      Severity: Minor
      Found in tensorflow/python/kernel_tests/math_ops/transpose_op_test.py - About 1 hr 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

      Function _compare_cpu_gpu has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def _compare_cpu_gpu(self, x):
          n = np.ndim(x)
          # generate all permutation of [0, 1, ... n-1] in random order,
          # choose the first two.
          perms = itertools.permutations(range(n))
      Severity: Minor
      Found in tensorflow/python/kernel_tests/math_ops/transpose_op_test.py - About 25 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 4 locations. Consider refactoring.
      Open

          inception_shapes = [[4, 5, 5, 124], [4, 8, 8, 38], [4, 8, 8, 38], [
              4, 8, 8, 204
          ], [4, 8, 8, 44], [4, 8, 8, 204], [4, 8, 8, 204], [4, 8, 8, 204], [
              4, 8, 8, 176
          ], [4, 8, 8, 176], [4, 8, 8, 176], [4, 8, 8, 176], [4, 17, 17, 19], [
      Severity: Major
      Found in tensorflow/python/kernel_tests/math_ops/transpose_op_test.py and 3 other locations - About 3 days to fix
      tensorflow/python/kernel_tests/nn_ops/conv_ops_test.py on lines 61..79
      tensorflow/python/kernel_tests/nn_ops/conv_ops_test.py on lines 80..98
      tensorflow/python/kernel_tests/nn_ops/conv_ops_test.py on lines 99..117

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

      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 testComplex64(self):
          self._testBoth(np.array(1 + 2j).astype(np.complex64))
          self._testBoth((1 + 2j) * np.arange(0, 21).astype(np.complex64))
          self._testBoth(
              (1 + 2j) * np.arange(0, 21).reshape([3, 7]).astype(np.complex64))
      Severity: Major
      Found in tensorflow/python/kernel_tests/math_ops/transpose_op_test.py and 1 other location - About 1 day to fix
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 401..411

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

      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 testComplex128(self):
          self._testBoth(np.array(1 + 2j).astype(np.complex128))
          self._testBoth((1 + 2j) * np.arange(0, 21).astype(np.complex128))
          self._testBoth(
              (1 + 2j) * np.arange(0, 21).reshape([3, 7]).astype(np.complex128))
      Severity: Major
      Found in tensorflow/python/kernel_tests/math_ops/transpose_op_test.py and 1 other location - About 1 day to fix
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 390..399

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

      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 datatype in datatypes:
            for input_shape, perm in zip(large_shapes, perms):
              with self.subTest(
                  datatype=datatype, input_shape=input_shape, perm=perm):
                total_size = np.prod(input_shape)
      Severity: Major
      Found in tensorflow/python/kernel_tests/math_ops/transpose_op_test.py and 1 other location - About 1 day to fix
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 161..174

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

      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 datatype in datatypes:
            for input_shape, perm in zip(large_shapes, perms):
              with self.subTest(
                  datatype=datatype, input_shape=input_shape, perm=perm):
                total_size = np.prod(input_shape)
      Severity: Major
      Found in tensorflow/python/kernel_tests/math_ops/transpose_op_test.py and 1 other location - About 1 day to fix
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 246..259

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

      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 input_shape, perm in zip(large_shapes, perms):
            with self.subTest(input_shape=input_shape, perm=perm):
              total_size = np.prod(input_shape)
              inp = np.arange(
                  1, total_size + 1, dtype=np.float32).reshape(input_shape)
      Severity: Major
      Found in tensorflow/python/kernel_tests/math_ops/transpose_op_test.py and 1 other location - About 1 day to fix
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 186..197

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

      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 input_shape, perm in zip(large_shapes, perms):
            with self.subTest(input_shape=input_shape, perm=perm):
              total_size = np.prod(input_shape)
              inp = np.arange(
                  1, total_size + 1, dtype=np.float32).reshape(input_shape)
      Severity: Major
      Found in tensorflow/python/kernel_tests/math_ops/transpose_op_test.py and 1 other location - About 1 day to fix
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 271..282

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

      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 testHalf(self):
          self._compare(np.arange(0, 21).reshape([3, 7]).astype(np.float16))
          self._compare(np.arange(0, 210).reshape([2, 3, 5, 7]).astype(np.float16))
          self._compare(
              np.arange(0, 16).reshape([1, 2, 1, 2, 1, 2, 1, 2]).astype(np.float16))
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 376..381
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 383..388

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

      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 testDouble(self):
          self._compare_cpu_gpu(np.arange(0, 21).reshape([3, 7]).astype(np.float64))
          self._compare_cpu_gpu(
              np.arange(0, 210).reshape([2, 3, 5, 7]).astype(np.float64))
          self._compare_cpu_gpu(
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 360..364
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 376..381

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

      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 testFloat(self):
          self._compare_cpu_gpu(np.arange(0, 21).reshape([3, 7]).astype(np.float32))
          self._compare_cpu_gpu(
              np.arange(0, 210).reshape([2, 3, 5, 7]).astype(np.float32))
          self._compare_cpu_gpu(
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 360..364
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 383..388

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

      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 testInt32(self):
          self._testBoth(np.arange(0, 21).reshape([3, 7]).astype(np.int32))
          self._testBoth(np.arange(0, 210).reshape([2, 3, 5, 7]).astype(np.int32))
          self._testBoth(
              np.arange(0, 1260).reshape([2, 3, 5, 7, 2, 3]).astype(np.int32))
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 413..417
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 419..423
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 431..435

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

        def testInt16(self):
          self._testBoth(np.arange(0, 21).reshape([3, 7]).astype(np.int16))
          self._testBoth(np.arange(0, 210).reshape([2, 3, 5, 7]).astype(np.int16))
          self._testBoth(
              np.arange(0, 1260).reshape([2, 3, 5, 7, 2, 3]).astype(np.int16))
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 413..417
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 425..429
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 431..435

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

        def testInt64(self):
          self._testBoth(np.arange(0, 21).reshape([3, 7]).astype(np.int64))
          self._testBoth(np.arange(0, 210).reshape([2, 3, 5, 7]).astype(np.int64))
          self._testBoth(
              np.arange(0, 1260).reshape([2, 3, 5, 7, 2, 3]).astype(np.int64))
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 413..417
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 419..423
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 425..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 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 4 locations. Consider refactoring.
      Open

        def testInt8(self):
          self._testBoth(np.arange(0, 21).reshape([3, 7]).astype(np.int8))
          self._testBoth(np.arange(0, 210).reshape([2, 3, 5, 7]).astype(np.int8))
          self._testBoth(
              np.arange(0, 1260).reshape([2, 3, 5, 7, 2, 3]).astype(np.int8))
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 419..423
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 425..429
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 431..435

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

            if x.dtype == np.float32:
              jacob_t, jacob_n = gradient_checker_v2.compute_gradient(
                  lambda x: array_ops.transpose(x, p, conjugate=conjugate), [inx])
              self.assertAllClose(jacob_t, jacob_n, 1e-3, 1e-3)
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 58..61
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 62..65
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 92..95

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

      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

            if x.dtype in [np.float32, np.complex64]:
              jacob_t, jacob_n = gradient_checker_v2.compute_gradient(
                  lambda x: array_ops.transpose(x, p, conjugate=conjugate), [inx])
              self.assertAllClose(jacob_t, jacob_n, 1e-3, 1e-3)
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 62..65
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 88..91
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 92..95

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

      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

            elif x.dtype in [np.float64, np.complex128]:
              jacob_t, jacob_n = gradient_checker_v2.compute_gradient(
                  lambda x: array_ops.transpose(x, p, conjugate=conjugate), [inx])
              self.assertAllClose(jacob_t, jacob_n, 1e-6, 1e-6)
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 58..61
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 88..91
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 92..95

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

      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

            elif x.dtype == np.float64:
              jacob_t, jacob_n = gradient_checker_v2.compute_gradient(
                  lambda x: array_ops.transpose(x, p, conjugate=conjugate), [inx])
              self.assertAllClose(jacob_t, jacob_n, 1e-6, 1e-6)
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 58..61
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 62..65
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 88..91

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

      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

          if p is None:
            rank = x.ndim
            perm = (rank - 1) - np.arange(rank)
          else:
            perm = p
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 70..74

      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

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

          if p is None:
            rank = x.ndim
            perm = (rank - 1) - np.arange(rank)
          else:
            perm = p
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 41..45

      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

            for p in all_perm[:2]:
              self._compareCpu(x, p, conjugate=c)
              if use_gpu:
                self._compareGpu(x, p, conjugate=c)
      Severity: Minor
      Found in tensorflow/python/kernel_tests/math_ops/transpose_op_test.py and 1 other location - About 35 mins to fix
      tensorflow/python/kernel_tests/math_ops/transpose_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 33.

      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

          for c in cs:
            self._compareCpu(x, None, conjugate=c)
            if use_gpu:
              self._compareGpu(x, None, conjugate=c)
      Severity: Minor
      Found in tensorflow/python/kernel_tests/math_ops/transpose_op_test.py and 1 other location - About 35 mins to fix
      tensorflow/python/kernel_tests/math_ops/transpose_op_test.py on lines 106..109

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

      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