tensorflow/tensorflow

View on GitHub
tensorflow/python/keras/layers/pooling.py

Summary

Maintainability
F
2 wks
Test Coverage

File pooling.py has 1117 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/keras/layers/pooling.py - About 2 days to fix

    Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def __init__(self, pool_function, pool_size, strides,
    Severity: Major
    Found in tensorflow/python/keras/layers/pooling.py - About 50 mins to fix

      Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def __init__(self, pool_function, pool_size, strides,
      Severity: Major
      Found in tensorflow/python/keras/layers/pooling.py - About 50 mins to fix

        Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def __init__(self, pool_function, pool_size, strides,
        Severity: Major
        Found in tensorflow/python/keras/layers/pooling.py - About 50 mins to fix

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

            def compute_output_shape(self, input_shape):
              input_shape = tensor_shape.TensorShape(input_shape).as_list()
              if self.data_format == 'channels_first':
                if self.keepdims:
                  return tensor_shape.TensorShape([input_shape[0], input_shape[1], 1])
          Severity: Minor
          Found in tensorflow/python/keras/layers/pooling.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 compute_output_shape has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def compute_output_shape(self, input_shape):
              input_shape = tensor_shape.TensorShape(input_shape).as_list()
              if self.data_format == 'channels_last':
                if self.keepdims:
                  return tensor_shape.TensorShape([input_shape[0], 1, 1, input_shape[3]])
          Severity: Minor
          Found in tensorflow/python/keras/layers/pooling.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 compute_output_shape has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def compute_output_shape(self, input_shape):
              input_shape = tensor_shape.TensorShape(input_shape).as_list()
              if self.data_format == 'channels_last':
                if self.keepdims:
                  return tensor_shape.TensorShape(
          Severity: Minor
          Found in tensorflow/python/keras/layers/pooling.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 __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def __init__(self,
          Severity: Minor
          Found in tensorflow/python/keras/layers/pooling.py - About 35 mins to fix

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

              def __init__(self,
            Severity: Minor
            Found in tensorflow/python/keras/layers/pooling.py - About 35 mins to fix

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

                def __init__(self, pool_size=2, strides=None,
              Severity: Minor
              Found in tensorflow/python/keras/layers/pooling.py - About 35 mins to fix

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

                  def __init__(self,
                Severity: Minor
                Found in tensorflow/python/keras/layers/pooling.py - About 35 mins to fix

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

                    def __init__(self, pool_size=2, strides=None,
                  Severity: Minor
                  Found in tensorflow/python/keras/layers/pooling.py - About 35 mins to fix

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

                      def __init__(self,
                    Severity: Minor
                    Found in tensorflow/python/keras/layers/pooling.py - About 35 mins to fix

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

                        def __init__(self, pool_function, pool_size, strides,
                                     padding='valid', data_format='channels_last',
                                     name=None, **kwargs):
                          super(Pooling1D, self).__init__(name=name, **kwargs)
                          if data_format is None:
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 1 other location - About 1 day to fix
                      tensorflow/python/keras/layers/pooling.py on lines 669..682

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 144.

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

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

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

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

                      Refactorings

                      Further Reading

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

                        def __init__(self, pool_function, pool_size, strides,
                                     padding='valid', data_format='channels_last',
                                     name=None, **kwargs):
                          super(Pooling3D, self).__init__(name=name, **kwargs)
                          if data_format is None:
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 1 other location - About 1 day to fix
                      tensorflow/python/keras/layers/pooling.py on lines 52..65

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 144.

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

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

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

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

                      Refactorings

                      Further Reading

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

                        def get_config(self):
                          config = {
                              'pool_size': self.pool_size,
                              'padding': self.padding,
                              'strides': self.strides,
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 2 other locations - About 3 hrs to fix
                      tensorflow/python/keras/layers/pooling.py on lines 95..103
                      tensorflow/python/keras/layers/pooling.py on lines 727..735

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

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

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

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

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

                      Refactorings

                      Further Reading

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

                        def get_config(self):
                          config = {
                              'strides': self.strides,
                              'pool_size': self.pool_size,
                              'padding': self.padding,
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 2 other locations - About 3 hrs to fix
                      tensorflow/python/keras/layers/pooling.py on lines 382..390
                      tensorflow/python/keras/layers/pooling.py on lines 727..735

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

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

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

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

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

                      Refactorings

                      Further Reading

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

                        def get_config(self):
                          config = {
                              'pool_size': self.pool_size,
                              'padding': self.padding,
                              'strides': self.strides,
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 2 other locations - About 3 hrs to fix
                      tensorflow/python/keras/layers/pooling.py on lines 95..103
                      tensorflow/python/keras/layers/pooling.py on lines 382..390

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

                      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

                      class GlobalMaxPooling3D(GlobalPooling3D):
                        """Global Max pooling operation for 3D data.
                      
                        Args:
                          data_format: A string,
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 1 other location - About 3 hrs to fix
                      tensorflow/python/keras/layers/pooling.py on lines 1210..1253

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

                      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

                      class GlobalAveragePooling3D(GlobalPooling3D):
                        """Global Average pooling operation for 3D data.
                      
                        Args:
                          data_format: A string,
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 1 other location - About 3 hrs to fix
                      tensorflow/python/keras/layers/pooling.py on lines 1256..1299

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

                      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

                      class GlobalMaxPooling2D(GlobalPooling2D):
                        """Global max pooling operation for spatial data.
                      
                        Examples:
                      
                      
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 1 other location - About 3 hrs to fix
                      tensorflow/python/keras/layers/pooling.py on lines 1073..1122

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

                      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

                      class GlobalAveragePooling2D(GlobalPooling2D):
                        """Global average pooling operation for spatial data.
                      
                        Examples:
                      
                      
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 1 other location - About 3 hrs to fix
                      tensorflow/python/keras/layers/pooling.py on lines 1125..1174

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

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

                        def get_config(self):
                          config = {'data_format': self.data_format, 'keepdims': self.keepdims}
                          base_config = super(GlobalPooling3D, self).get_config()
                          return dict(list(base_config.items()) + list(config.items()))
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 4 other locations - About 3 hrs to fix
                      tensorflow/python/keras/layers/dense_attention.py on lines 210..216
                      tensorflow/python/keras/layers/merge.py on lines 720..726
                      tensorflow/python/keras/layers/pooling.py on lines 903..906
                      tensorflow/python/keras/layers/pooling.py on lines 1067..1070

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 64.

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

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

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

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

                      Refactorings

                      Further Reading

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

                        def get_config(self):
                          config = {'data_format': self.data_format, 'keepdims': self.keepdims}
                          base_config = super(GlobalPooling2D, self).get_config()
                          return dict(list(base_config.items()) + list(config.items()))
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 4 other locations - About 3 hrs to fix
                      tensorflow/python/keras/layers/dense_attention.py on lines 210..216
                      tensorflow/python/keras/layers/merge.py on lines 720..726
                      tensorflow/python/keras/layers/pooling.py on lines 903..906
                      tensorflow/python/keras/layers/pooling.py on lines 1204..1207

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 64.

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

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

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

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

                      Refactorings

                      Further Reading

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

                        def get_config(self):
                          config = {'data_format': self.data_format, 'keepdims': self.keepdims}
                          base_config = super(GlobalPooling1D, self).get_config()
                          return dict(list(base_config.items()) + list(config.items()))
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 4 other locations - About 3 hrs to fix
                      tensorflow/python/keras/layers/dense_attention.py on lines 210..216
                      tensorflow/python/keras/layers/merge.py on lines 720..726
                      tensorflow/python/keras/layers/pooling.py on lines 1067..1070
                      tensorflow/python/keras/layers/pooling.py on lines 1204..1207

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 64.

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

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

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

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

                      Refactorings

                      Further Reading

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

                      class AveragePooling1D(Pooling1D):
                        """Average pooling for temporal data.
                      
                        Downsamples the input representation by taking the average value over the
                        window defined by `pool_size`. The window is shifted by `strides`.  The
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 1 other location - About 3 hrs to fix
                      tensorflow/python/keras/layers/pooling.py on lines 106..189

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

                      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

                      class MaxPooling1D(Pooling1D):
                        """Max pooling operation for 1D temporal data.
                      
                        Downsamples the input representation by taking the maximum value over a
                        spatial window of size `pool_size`. The window is shifted by `strides`.  The
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 1 other location - About 3 hrs to fix
                      tensorflow/python/keras/layers/pooling.py on lines 197..300

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

                      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 __init__(self, data_format=None, keepdims=False, **kwargs):
                          super(GlobalPooling3D, self).__init__(**kwargs)
                          self.data_format = conv_utils.normalize_data_format(data_format)
                          self.input_spec = InputSpec(ndim=5)
                          self.keepdims = keepdims
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 1 other location - About 2 hrs to fix
                      tensorflow/python/keras/layers/pooling.py on lines 1045..1049

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

                      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 __init__(self, data_format=None, keepdims=False, **kwargs):
                          super(GlobalPooling2D, self).__init__(**kwargs)
                          self.data_format = conv_utils.normalize_data_format(data_format)
                          self.input_spec = InputSpec(ndim=4)
                          self.keepdims = keepdims
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 1 other location - About 2 hrs to fix
                      tensorflow/python/keras/layers/pooling.py on lines 1180..1184

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

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

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

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

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

                      Refactorings

                      Further Reading

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

                          if self.data_format == 'channels_first':
                            steps = input_shape[2]
                            features = input_shape[1]
                          else:
                            steps = input_shape[1]
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 1 other location - About 2 hrs to fix
                      tensorflow/python/keras/layers/pooling.py on lines 365..370

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

                      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

                      class AveragePooling3D(Pooling3D):
                        """Average pooling operation for 3D data (spatial or spatio-temporal).
                      
                        Downsamples the input along its spatial dimensions (depth, height, and width)
                        by taking the average value over an input window
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 1 other location - About 2 hrs to fix
                      tensorflow/python/keras/layers/pooling.py on lines 738..803

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

                      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

                      class MaxPooling3D(Pooling3D):
                        """Max pooling operation for 3D data (spatial or spatio-temporal).
                      
                        Downsamples the input along its spatial dimensions (depth, height, and width)
                        by taking the maximum value over an input window
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 1 other location - About 2 hrs to fix
                      tensorflow/python/keras/layers/pooling.py on lines 808..873

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

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

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

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

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

                      Refactorings

                      Further Reading

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

                          if self.data_format == 'channels_first':
                            rows = input_shape[2]
                            cols = input_shape[3]
                          else:
                            rows = input_shape[1]
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 1 other location - About 2 hrs to fix
                      tensorflow/python/keras/layers/pooling.py on lines 80..85

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

                      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

                      class MaxPooling2D(Pooling2D):
                        """Max pooling operation for 2D spatial data.
                      
                        Downsamples the input along its spatial dimensions (height and width)
                        by taking the maximum value over an input window
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 1 other location - About 2 hrs to fix
                      tensorflow/python/keras/layers/pooling.py on lines 529..637

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 56.

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

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

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

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

                      Refactorings

                      Further Reading

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

                      class AveragePooling2D(Pooling2D):
                        """Average pooling operation for spatial data.
                      
                        Downsamples the input along its spatial dimensions (height and width)
                        by taking the average value over an input window
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 1 other location - About 2 hrs to fix
                      tensorflow/python/keras/layers/pooling.py on lines 393..524

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 56.

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

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

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

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

                      Refactorings

                      Further Reading

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

                          length = conv_utils.conv_output_length(steps,
                                                                 self.pool_size[0],
                                                                 self.padding,
                                                                 self.strides[0])
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 5 other locations - About 30 mins to fix
                      tensorflow/python/keras/layers/pooling.py on lines 371..372
                      tensorflow/python/keras/layers/pooling.py on lines 373..374
                      tensorflow/python/keras/layers/pooling.py on lines 714..715
                      tensorflow/python/keras/layers/pooling.py on lines 716..717
                      tensorflow/python/keras/layers/pooling.py on lines 718..719

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 32.

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

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

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

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

                      Refactorings

                      Further Reading

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

                          cols = conv_utils.conv_output_length(cols, self.pool_size[1], self.padding,
                                                               self.strides[1])
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 5 other locations - About 30 mins to fix
                      tensorflow/python/keras/layers/pooling.py on lines 86..89
                      tensorflow/python/keras/layers/pooling.py on lines 371..372
                      tensorflow/python/keras/layers/pooling.py on lines 714..715
                      tensorflow/python/keras/layers/pooling.py on lines 716..717
                      tensorflow/python/keras/layers/pooling.py on lines 718..719

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 32.

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

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

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

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

                      Refactorings

                      Further Reading

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

                          len_dim2 = conv_utils.conv_output_length(len_dim2, self.pool_size[1],
                                                                   self.padding, self.strides[1])
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 5 other locations - About 30 mins to fix
                      tensorflow/python/keras/layers/pooling.py on lines 86..89
                      tensorflow/python/keras/layers/pooling.py on lines 371..372
                      tensorflow/python/keras/layers/pooling.py on lines 373..374
                      tensorflow/python/keras/layers/pooling.py on lines 714..715
                      tensorflow/python/keras/layers/pooling.py on lines 718..719

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 32.

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

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

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

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

                      Refactorings

                      Further Reading

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

                          rows = conv_utils.conv_output_length(rows, self.pool_size[0], self.padding,
                                                               self.strides[0])
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 5 other locations - About 30 mins to fix
                      tensorflow/python/keras/layers/pooling.py on lines 86..89
                      tensorflow/python/keras/layers/pooling.py on lines 373..374
                      tensorflow/python/keras/layers/pooling.py on lines 714..715
                      tensorflow/python/keras/layers/pooling.py on lines 716..717
                      tensorflow/python/keras/layers/pooling.py on lines 718..719

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 32.

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

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

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

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

                      Refactorings

                      Further Reading

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

                          len_dim3 = conv_utils.conv_output_length(len_dim3, self.pool_size[2],
                                                                   self.padding, self.strides[2])
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 5 other locations - About 30 mins to fix
                      tensorflow/python/keras/layers/pooling.py on lines 86..89
                      tensorflow/python/keras/layers/pooling.py on lines 371..372
                      tensorflow/python/keras/layers/pooling.py on lines 373..374
                      tensorflow/python/keras/layers/pooling.py on lines 714..715
                      tensorflow/python/keras/layers/pooling.py on lines 716..717

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 32.

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

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

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

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

                      Refactorings

                      Further Reading

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

                          len_dim1 = conv_utils.conv_output_length(len_dim1, self.pool_size[0],
                                                                   self.padding, self.strides[0])
                      Severity: Major
                      Found in tensorflow/python/keras/layers/pooling.py and 5 other locations - About 30 mins to fix
                      tensorflow/python/keras/layers/pooling.py on lines 86..89
                      tensorflow/python/keras/layers/pooling.py on lines 371..372
                      tensorflow/python/keras/layers/pooling.py on lines 373..374
                      tensorflow/python/keras/layers/pooling.py on lines 716..717
                      tensorflow/python/keras/layers/pooling.py on lines 718..719

                      Duplicated Code

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

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

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

                      Tuning

                      This issue has a mass of 32.

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

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

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

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

                      Refactorings

                      Further Reading

                      There are no issues that match your filters.

                      Category
                      Status