tensorflow/tensorflow

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

Summary

Maintainability
F
1 wk
Test Coverage

File pooling_ops_test.py has 2347 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    PoolingTest has 112 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class PoolingTest(test.TestCase, parameterized.TestCase):
    
      def _isMaxPool(self, func):
        return func in (nn_ops.max_pool, nn_ops.max_pool_v2)
    
    
    Severity: Major
    Found in tensorflow/python/kernel_tests/nn_ops/pooling_ops_test.py - About 2 days to fix

      Function _VerifyOneType has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

        def _VerifyOneType(
            self,
            pool_func,
            input_sizes,
            ksize,
      Severity: Minor
      Found in tensorflow/python/kernel_tests/nn_ops/pooling_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 _VerifyOneType has 12 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def _VerifyOneType(
      Severity: Major
      Found in tensorflow/python/kernel_tests/nn_ops/pooling_ops_test.py - About 1 hr to fix

        Function _testMaxPoolGradDirect has 12 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def _testMaxPoolGradDirect(self, input_data, output_backprop,
        Severity: Major
        Found in tensorflow/python/kernel_tests/nn_ops/pooling_ops_test.py - About 1 hr to fix

          Function GetTestConfigsDicts has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          def GetTestConfigsDicts(v1_fn,
                                  v2_fn=None,
                                  one_dimensional=False,
                                  allow_gpu=True):
            # (data_format, use_gpu) tuple
          Severity: Minor
          Found in tensorflow/python/kernel_tests/nn_ops/pooling_ops_test.py - About 1 hr to fix

          Cognitive Complexity

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

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

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

          Further reading

          Function _ConstructAndTestSecondGradient has 11 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def _ConstructAndTestSecondGradient(self,
          Severity: Major
          Found in tensorflow/python/kernel_tests/nn_ops/pooling_ops_test.py - About 1 hr to fix

            Function _ConstructAndTestGradient has 11 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def _ConstructAndTestGradient(self,
            Severity: Major
            Found in tensorflow/python/kernel_tests/nn_ops/pooling_ops_test.py - About 1 hr to fix

              Function _VerifyValues has 10 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                def _VerifyValues(self,
              Severity: Major
              Found in tensorflow/python/kernel_tests/nn_ops/pooling_ops_test.py - About 1 hr to fix

                Function _VerifyOneTest has 10 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  def _VerifyOneTest(self, pool_func, input_sizes, ksize, strides, padding,
                Severity: Major
                Found in tensorflow/python/kernel_tests/nn_ops/pooling_ops_test.py - About 1 hr to fix

                  Function _MaxPoolGrad has 9 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    def _MaxPoolGrad(self, orig_input, orig_output, grad, window_rows,
                  Severity: Major
                  Found in tensorflow/python/kernel_tests/nn_ops/pooling_ops_test.py - About 1 hr to fix

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

                      def _ConstructAndTestGradient(self,
                                                    pool_func,
                                                    input_sizes,
                                                    output_sizes,
                                                    window_rows,
                    Severity: Minor
                    Found in tensorflow/python/kernel_tests/nn_ops/pooling_ops_test.py - About 1 hr to fix

                    Cognitive Complexity

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

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

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

                    Further reading

                    Function _MaxPoolGradGrad has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      def _MaxPoolGradGrad(self, orig_input, orig_output, grad, window_rows,
                    Severity: Major
                    Found in tensorflow/python/kernel_tests/nn_ops/pooling_ops_test.py - About 1 hr to fix

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

                        def _VerifyOneTest(self, pool_func, input_sizes, ksize, strides, padding,
                                           data_format, expected, use_gpu, v2,
                                           use_negative_input=False):
                          """Verifies the output values of the pooling function.
                      
                      
                      Severity: Minor
                      Found in tensorflow/python/kernel_tests/nn_ops/pooling_ops_test.py - About 55 mins to fix

                      Cognitive Complexity

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

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

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

                      Further reading

                      Function GetTestConfigs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def GetTestConfigs(include_nchw_vect_c=False, one_dimensional=False):
                        """Get all the valid tests configs to run.
                      
                        Args:
                          include_nchw_vect_c: Whether to include NCHW_VECT_C in the test configs.
                      Severity: Minor
                      Found in tensorflow/python/kernel_tests/nn_ops/pooling_ops_test.py - About 45 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 _ConstructAndTestSecondGradient has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def _ConstructAndTestSecondGradient(self,
                                                            pool_func,
                                                            input_sizes,
                                                            output_sizes,
                                                            window_rows,
                      Severity: Minor
                      Found in tensorflow/python/kernel_tests/nn_ops/pooling_ops_test.py - About 45 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 _CompareMaxPoolingGradBk has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        def _CompareMaxPoolingGradBk(self, input_shape, output_shape, ksize, strides,
                      Severity: Minor
                      Found in tensorflow/python/kernel_tests/nn_ops/pooling_ops_test.py - About 35 mins to fix

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

                          def _CompareMaxPoolingBk(self, input_shape, output_shape, ksize, strides,
                        Severity: Minor
                        Found in tensorflow/python/kernel_tests/nn_ops/pooling_ops_test.py - About 35 mins to fix

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

                            def _testDepthwiseMaxPoolInvalidConfig(self,
                          Severity: Minor
                          Found in tensorflow/python/kernel_tests/nn_ops/pooling_ops_test.py - About 35 mins to fix

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

                            def GetMaxPoolGradGradTest(input_size, filter_size, output_size, strides,
                            Severity: Minor
                            Found in tensorflow/python/kernel_tests/nn_ops/pooling_ops_test.py - About 35 mins to fix

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

                              def GetMaxPoolGradTest(input_size, filter_size, output_size, strides, padding):
                              Severity: Minor
                              Found in tensorflow/python/kernel_tests/nn_ops/pooling_ops_test.py - About 35 mins to fix

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

                                  def _testMaxPoolGradDirectWithNans2_2(self):
                                    input_data = [float("nan")] * 16
                                    output_backprop = [
                                        float("nan"), 12.0, 13.0, 15.0,
                                        float("nan"), 17.0, 19.0, 20.0,
                                Severity: Minor
                                Found in tensorflow/python/kernel_tests/nn_ops/pooling_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 _testMaxPoolGradDirectWithNans2_1 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  def _testMaxPoolGradDirectWithNans2_1(self):
                                    input_data = [float("nan")] * 16
                                    output_backprop = [11.0, 12.0, 13.0, 15.0, 16.0, 17.0, 19.0, 20.0, 21.0]
                                    # Test the CPU implementation, which propagates diffs in case of NaN
                                    expected_input_backprop_tf_cpu = [
                                Severity: Minor
                                Found in tensorflow/python/kernel_tests/nn_ops/pooling_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

                                There are no issues that match your filters.

                                Category
                                Status