tensorflow/tensorflow

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

Summary

Maintainability
F
1 mo
Test Coverage

File segment_reduction_ops_test.py has 1240 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2015 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Severity: Major
Found in tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py - About 3 days to fix

    SparseSegmentReductionOpTest has 40 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class SparseSegmentReductionOpTest(SparseSegmentReductionHelper):
    
      def testValues(self):
        dtypes = [
            dtypes_lib.float32,
    Severity: Minor
    Found in tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py - About 5 hrs to fix

      Function testValues has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

        def testValues(self):
          dtypes = [
              dtypes_lib.float32,
              dtypes_lib.float64,
              dtypes_lib.int64,
      Severity: Minor
      Found in tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py - About 3 hrs 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 testValues has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

        def testValues(self, dtype):
          indices_flat = np.array([0, 4, 0, 8, 3, 8, 4, 7, 7, 3])
          num_segments = 12
          for indices in indices_flat, indices_flat.reshape(5, 2):
            # Note that the GPU implem has different paths for different inner sizes.
      Severity: Minor
      Found in tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py - About 2 hrs 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 _segmentReduce has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        def _segmentReduce(
            self,
            indices,
            x,
            op1,

      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 testValues has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        def testValues(self, dtype):
          # Each item is np_op1, np_op2, tf_op
          ops_list = [(np.add, None, math_ops.segment_sum),
                      (self._mean_cum_op, self._mean_reduce_op,
                       math_ops.segment_mean),

      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 testGradientsTFGradients has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        def testGradientsTFGradients(self):
          num_cols = 2
          indices_flat = np.array([0, 4, 0, -1, 3, -1, 4, 7, 7, 3])
          num_segments = max(indices_flat) + 3
          for dtype in self.differentiable_dtypes:

      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 _segmentReduce has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def _segmentReduce(
      Severity: Major
      Found in tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py - About 50 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    for np_op1, np_op2, tf_op, init_op in ops_list:
                      # sqrt_n doesn't support integers
                      if (np_op2 == self._sqrt_n_reduce_op and dtype.is_integer):
                        continue
                      np_ans = self._segmentReduce(
        Severity: Major
        Found in tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                      for _, _, tf_op, _ in ops_list:
                        tf_x, np_x = self._input(shape, dtype=dtype)
                        s = tf_op(tf_x, indices, num_segments)
                        jacob_t, jacob_n = gradient_checker.compute_gradient(
                            tf_x,
          Severity: Major
          Found in tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py - About 45 mins to fix

            Function _sparseSegmentReduce has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def _sparseSegmentReduce(self,
            Severity: Minor
            Found in tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                          with self.cached_session():
                            tf_indices, np_indices, tf_x, np_x = self._sparse_input(
                                shape, num_indices, dtype=dtype)
                            for np_op1, np_op2, tf_op in ops_list:
                              if (tf_op == math_ops.sparse_segment_mean and
              Severity: Major
              Found in tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py - About 45 mins to fix

                Function _sparseSegmentReduceGrad has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def _sparseSegmentReduceGrad(
                Severity: Minor
                Found in tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py - About 35 mins to fix

                  Function _runGraph has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    def _runGraph(self, op_functor, outer_dim, ratio, inner_dim, dtype):
                  Severity: Minor
                  Found in tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py - About 35 mins to fix

                    Function testGradientsGradientTape has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def testGradientsGradientTape(self, dtype):
                        num_cols = 2
                        indices_flat = np.array([0, 4, 0, -1, 3, -1, 4, 7, 7, 3])
                        num_segments = max(indices_flat) + 3
                    
                    
                    Severity: Minor
                    Found in tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py - About 35 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

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

                      def _sparseSegmentReduceGradWeights(self, ygrad, segment_ids, mode):
                        assert mode in ("sum", "mean", "sqrtn")
                        if mode == "sum":
                          weights = np.ones(ygrad.shape[0], ygrad.dtype)
                        else:
                    Severity: Minor
                    Found in tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_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 2 locations. Consider refactoring.
                    Open

                      def testGradientV2Explicit(self):
                        # Note that the GPU implem has different paths for different inner sizes.
                        for inner_size in (1, 2, 3, 32):
                          with self.session():
                            tf_ygrad, np_ygrad = self._input(
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1092..1115

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

                    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 testGradientV2ExplicitSingleOutput(self):
                        # The GPU implem has a special case when there is a single output.
                        for inner_size in (1, 2, 3, 32):
                          with self.session():
                            tf_ygrad, np_ygrad = self._input(
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1067..1090

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

                    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 indices in indices_flat, indices_flat.reshape(5, 2):
                          shape = indices.shape + (2,)
                          for dtype in dtypes:
                            with self.cached_session():
                              tf_x, np_x = self._input(shape)
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 409..423

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

                    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 testSegmentIdsGreaterThanZero(self):
                        tf_x, np_x = self._input([10, 4], dtype=dtypes_lib.float32)
                        ops_list = [(np.add, None, math_ops.sparse_segment_sum), (
                            self._mean_cum_op, self._mean_reduce_op, math_ops.sparse_segment_mean)]
                        segment_indices = [1, 2, 2, 2]
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 719..731

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

                    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 indices in indices_flat, indices_flat.reshape(5, 2):
                          shape = indices.shape + (2,)
                          for dtype in dtypes:
                            with self.cached_session():
                              tf_x, np_x = self._input(shape)
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 388..403

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

                    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 testSegmentIdsHole(self):
                        tf_x, np_x = self._input([10, 4], dtype=dtypes_lib.float32)
                        ops_list = [(np.add, None, math_ops.sparse_segment_sum), (
                            self._mean_cum_op, self._mean_reduce_op, math_ops.sparse_segment_mean)]
                        segment_indices = [0, 2, 2, 2]
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 792..804

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

                    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 testGradientExplicitSingleOutput(self):
                        # The GPU implem has a special case when there is a single output.
                        for inner_size in (1, 2, 3, 32):
                          with self.session():
                            tf_ygrad, np_ygrad = self._input([3, inner_size],
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1025..1044

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

                    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 testGradientExplicit(self):
                        # Note that the GPU implem has different paths for different inner sizes.
                        for inner_size in (1, 2, 3, 32):
                          with self.session():
                            tf_ygrad, np_ygrad = self._input([3, inner_size],
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1046..1065

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

                    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

                      @test_util.run_deprecated_v1
                      def testGradientV2IndicesInvalid2(self):
                        tf_x, _ = self._input([3, 4], dtype=dtypes_lib.float32)
                        ops_list = [
                            math_ops.sparse_segment_sum_grad_v2,
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1263..1277
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1295..1311
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1313..1327
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1329..1343
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1345..1359

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

                    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

                      @test_util.run_deprecated_v1
                      def testGradientV2SegmentsInvalid2(self):
                        tf_x, _ = self._input([1, 4], dtype=dtypes_lib.float32)
                        ops_list = [
                            math_ops.sparse_segment_sum_grad_v2,
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1263..1277
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1279..1293
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1295..1311
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1329..1343
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1345..1359

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

                    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

                      @test_util.run_deprecated_v1
                      def testGradientV2SegmentsInvalid4(self):
                        tf_x, _ = self._input([0, 4], dtype=dtypes_lib.float32)
                        ops_list = [
                            math_ops.sparse_segment_sum_grad_v2,
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1263..1277
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1279..1293
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1295..1311
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1313..1327
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1329..1343

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

                    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

                      @test_util.run_deprecated_v1
                      def testGradientV2SegmentsInvalid1(self):
                        tf_x, _ = self._input(
                            [3, 4], dtype=dtypes_lib.float32
                        )  # expecting 3 segments
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1263..1277
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1279..1293
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1313..1327
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1329..1343
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1345..1359

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

                    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

                      @test_util.run_deprecated_v1
                      def testGradientV2IndicesInvalid1(self):
                        tf_x, _ = self._input([3, 4], dtype=dtypes_lib.float32)
                        ops_list = [
                            math_ops.sparse_segment_sum_grad_v2,
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1279..1293
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1295..1311
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1313..1327
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1329..1343
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1345..1359

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

                    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

                      @test_util.run_deprecated_v1
                      def testGradientV2SegmentsInvalid3(self):
                        tf_x, _ = self._input([2, 4], dtype=dtypes_lib.float32)
                        ops_list = [
                            math_ops.sparse_segment_sum_grad_v2,
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1263..1277
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1279..1293
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1295..1311
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1313..1327
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1345..1359

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

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

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

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

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

                    Refactorings

                    Further Reading

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

                      @test_util.run_deprecated_v1
                      def testIndicesInvalid1(self):
                        tf_x, _ = self._input([10, 4], dtype=dtypes_lib.float32)
                        ops_list = [math_ops.sparse_segment_sum, math_ops.sparse_segment_mean]
                        segment_indices = [0, 1, 2, 2]
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 830..841
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 843..853
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 855..867
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 869..881
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 883..893
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 895..905

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

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

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

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

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

                    Refactorings

                    Further Reading

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

                      @test_util.run_deprecated_v1
                      def testIndicesInvalid2(self):
                        tf_x, _ = self._input([10, 4], dtype=dtypes_lib.float32)
                        ops_list = [math_ops.sparse_segment_sum, math_ops.sparse_segment_mean]
                        segment_indices = [0, 1, 2, 2]
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 817..828
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 843..853
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 855..867
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 869..881
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 883..893
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 895..905

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

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

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

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

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

                    Refactorings

                    Further Reading

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

                      @test_util.run_deprecated_v1
                      def testSegmentsInvalid2(self):
                        tf_x, _ = self._input([10, 4], dtype=dtypes_lib.float32)
                        ops_list = [math_ops.sparse_segment_sum, math_ops.sparse_segment_mean]
                        segment_indices = [0, 1, 0, 1]
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 817..828
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 830..841
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 855..867
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 869..881
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 883..893
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 895..905

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

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

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

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

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

                    Refactorings

                    Further Reading

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

                      @test_util.run_deprecated_v1
                      def testSegmentsInvalid4(self):
                        tf_x, _ = self._input([10, 4], dtype=dtypes_lib.float32)
                        ops_list = [math_ops.sparse_segment_sum, math_ops.sparse_segment_mean]
                        segment_indices = [-1, 0, 1, 1]
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 817..828
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 830..841
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 843..853
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 855..867
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 883..893
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 895..905

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

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

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

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

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

                    Refactorings

                    Further Reading

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

                      @test_util.run_deprecated_v1
                      def testSegmentsInvalid7(self):
                        tf_x, _ = self._input([10, 4], dtype=dtypes_lib.float32)
                        ops_list = [math_ops.sparse_segment_sum, math_ops.sparse_segment_mean]
                        segment_indices = [0, 0, 0, -2]
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 817..828
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 830..841
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 843..853
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 855..867
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 869..881
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 883..893

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

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

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

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

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

                    Refactorings

                    Further Reading

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

                      @test_util.run_deprecated_v1
                      def testSegmentsInvalid3(self):
                        tf_x, _ = self._input([10, 4], dtype=dtypes_lib.float32)
                        ops_list = [math_ops.sparse_segment_sum, math_ops.sparse_segment_mean]
                        segment_indices = [0, 1, 2, 0]
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 817..828
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 830..841
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 843..853
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 869..881
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 883..893
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 895..905

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

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

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

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

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

                    Refactorings

                    Further Reading

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

                      @test_util.run_deprecated_v1
                      def testSegmentsInvalid6(self):
                        tf_x, _ = self._input([10, 4], dtype=dtypes_lib.float32)
                        ops_list = [math_ops.sparse_segment_sum, math_ops.sparse_segment_mean]
                        segment_indices = [0, 0, 0, -1]
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 817..828
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 830..841
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 843..853
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 855..867
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 869..881
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 895..905

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

                    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

                      @test_util.run_deprecated_v1
                      def testGradientSegmentsInvalid3(self):
                        tf_x, _ = self._input([2, 4], dtype=dtypes_lib.float32)
                        ops_list = [
                            math_ops.sparse_segment_sum_grad, math_ops.sparse_segment_mean_grad,
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1157..1170
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1172..1185
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1187..1201
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1203..1216
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1233..1246

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

                    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

                      @test_util.run_deprecated_v1
                      def testGradientIndicesInvalid2(self):
                        tf_x, _ = self._input([3, 4], dtype=dtypes_lib.float32)
                        ops_list = [
                            math_ops.sparse_segment_sum_grad, math_ops.sparse_segment_mean_grad,
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1157..1170
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1187..1201
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1203..1216
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1218..1231
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1233..1246

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

                    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

                      @test_util.run_deprecated_v1
                      def testGradientIndicesInvalid1(self):
                        tf_x, _ = self._input([3, 4], dtype=dtypes_lib.float32)
                        ops_list = [
                            math_ops.sparse_segment_sum_grad, math_ops.sparse_segment_mean_grad,
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1172..1185
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1187..1201
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1203..1216
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1218..1231
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1233..1246

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

                    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

                      @test_util.run_deprecated_v1
                      def testGradientSegmentsInvalid2(self):
                        tf_x, _ = self._input([1, 4], dtype=dtypes_lib.float32)
                        ops_list = [
                            math_ops.sparse_segment_sum_grad, math_ops.sparse_segment_mean_grad,
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1157..1170
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1172..1185
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1187..1201
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1218..1231
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1233..1246

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

                    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

                      @test_util.run_deprecated_v1
                      def testGradientSegmentsInvalid1(self):
                        tf_x, _ = self._input(
                            [3, 4], dtype=dtypes_lib.float32)  # expecting 3 segments
                        ops_list = [
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1157..1170
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1172..1185
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1203..1216
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1218..1231
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1233..1246

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

                    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

                      @test_util.run_deprecated_v1
                      def testGradientSegmentsInvalid4(self):
                        tf_x, _ = self._input([0, 4], dtype=dtypes_lib.float32)
                        ops_list = [
                            math_ops.sparse_segment_sum_grad, math_ops.sparse_segment_mean_grad,
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1157..1170
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1172..1185
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1187..1201
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1203..1216
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1218..1231

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

                    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 testSegmentIdsGreaterThanZero(self):
                        shape = [4, 4]
                        for use_gpu in [True, False]:
                          with self.cached_session(use_gpu=use_gpu):
                            tf_x, np_x = self._input(shape, dtype=dtypes_lib.float32)
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 190..199

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

                    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 testSegmentIdsHole(self):
                        shape = [4, 4]
                        for use_gpu in [True, False]:
                          with self.cached_session(use_gpu=use_gpu):
                            tf_x, np_x = self._input(shape, dtype=dtypes_lib.float32)
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 179..188

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

                    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_deprecated_v1
                      def testSegmentIdsInvalid5(self):
                        shape = [4, 4]
                        for use_gpu in [True, False]:
                          with self.cached_session(use_gpu=use_gpu):
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 252..261

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

                    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_deprecated_v1
                      def testSegmentIdsInvalid4(self):
                        shape = [4, 4]
                        for use_gpu in [True, False]:
                          with self.cached_session(use_gpu=use_gpu):
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 263..272

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

                    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

                      @test_util.run_deprecated_v1
                      def testSegmentIdsInvalid2(self):
                        shape = [4, 4]
                        with self.cached_session():
                          tf_x, _ = self._input(shape)
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 218..228
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 240..250

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

                    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

                      @test_util.run_deprecated_v1
                      def testSegmentIdsInvalid3(self):
                        shape = [4, 4]
                        with self.cached_session():
                          tf_x, _ = self._input(shape)
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 218..228
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 230..238

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

                    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

                      @test_util.run_deprecated_v1
                      def testSegmentIdsInvalid1(self):
                        shape = [4, 4]
                        with self.cached_session():
                          tf_x, _ = self._input(shape)
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 230..238
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 240..250

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

                    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 benchmarkSegmentSumGPU(self):
                        if not test.is_gpu_available(cuda_only=True):
                          return
                        for outer_dim, ratio, inner_dim, dtype in itertools.product(*self.options):
                          op_functor = self.op_functors[0]
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1415..1421

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

                    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 benchmarkUnsortedSegmentSumGPU(self):
                        if not test.is_gpu_available(cuda_only=True):
                          return
                        for outer_dim, ratio, inner_dim, dtype in itertools.product(*self.options):
                          op_functor = self.op_functors[1]
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1407..1413

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

                    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 segment, unique_index in zip(segment_ids, unique_indices_inverse):
                          xgrad_unique[unique_index] += ygrad[segment] * weights[segment]
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 645..646

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

                    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 segment, index in zip(segment_ids, indices):
                          xgrad[index] += ygrad[segment] * weights[segment]
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 658..659

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

                    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

                            jacob_t, jacob_n = gradient_checker.compute_gradient(
                                tf_x,
                                shape,
                                s, [3, 4],
                                x_init_value=np_x.astype(np.double),
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 990..994
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1017..1021
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1138..1139

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

                            jacob_t, jacob_n = gradient_checker.compute_gradient(
                                tf_x,
                                shape,
                                s, [5, 4],
                                x_init_value=np_x.astype(np.double),
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 285..289
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 990..994
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1138..1139

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

                            jacob_t, jacob_n = gradient_checker.compute_gradient(
                                tf_x, shape, s, [3, 4], x_init_value=np_x.astype(np.double), delta=1
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 285..289
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 990..994
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1017..1021

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

                            jacob_t, jacob_n = gradient_checker.compute_gradient(
                                tf_x,
                                shape,
                                s, [3, 4],
                                x_init_value=np_x.astype(np.double),
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 285..289
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1017..1021
                    tensorflow/python/kernel_tests/math_ops/segment_reduction_ops_test.py on lines 1138..1139

                    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

                    There are no issues that match your filters.

                    Category
                    Status