tensorflow/tensorflow

View on GitHub
tensorflow/python/keras/backend.py

Summary

Maintainability
F
1 mo
Test Coverage

File backend.py has 4969 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/backend.py - About 2 wks to fix

    Function rnn has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring.
    Open

    def rnn(step_function,
            inputs,
            initial_states,
            go_backwards=False,
            mask=None,
    Severity: Minor
    Found in tensorflow/python/keras/backend.py - About 1 day 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 batch_dot has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

    def batch_dot(x, y, axes=None):
      """Batchwise dot product.
    
      `batch_dot` is used to compute dot product of `x` and `y` when
      `x` and `y` are data in batch, i.e. in a shape of
    Severity: Minor
    Found in tensorflow/python/keras/backend.py - About 4 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 placeholder has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

    def placeholder(shape=None,
                    ndim=None,
                    dtype=None,
                    sparse=False,
                    name=None,
    Severity: Minor
    Found in tensorflow/python/keras/backend.py - About 4 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 batch_normalization has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    def batch_normalization(x, mean, var, beta, gamma, axis=-1, epsilon=1e-3):
      """Applies batch normalization on x given mean, var, beta and gamma.
    
      I.e. returns:
      `output = (x - mean) / (sqrt(var) + epsilon) * gamma + beta`
    Severity: Minor
    Found in tensorflow/python/keras/backend.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 sparse_categorical_crossentropy has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def sparse_categorical_crossentropy(target, output, from_logits=False, axis=-1):
      """Categorical crossentropy with integer targets.
    
      Args:
          target: An integer tensor.
    Severity: Minor
    Found in tensorflow/python/keras/backend.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 dot has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def dot(x, y):
      """Multiplies 2 tensors (and/or variables) and returns a tensor.
    
      This operation corresponds to `numpy.dot(a, b, out=None)`.
    
    
    Severity: Minor
    Found in tensorflow/python/keras/backend.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 switch has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def switch(condition, then_expression, else_expression):
      """Switches between two operations depending on a scalar value.
    
      Note that both `then_expression` and `else_expression`
      should be symbolic tensors of the *same shape*.
    Severity: Minor
    Found in tensorflow/python/keras/backend.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 function has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def function(inputs, outputs, updates=None, name=None, **kwargs):
      """Instantiates a Keras function.
    
      Args:
          inputs: List of placeholder tensors.
    Severity: Minor
    Found in tensorflow/python/keras/backend.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 _current_graph has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def _current_graph(op_input_list, graph=None):
      """Returns the appropriate graph to use for the given inputs.
    
      This library method provides a consistent algorithm for choosing the graph
      in which an Operation should be constructed:
    Severity: Minor
    Found in tensorflow/python/keras/backend.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 in_train_phase has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def in_train_phase(x, alt, training=None):
      """Selects `x` in train phase, and `alt` otherwise.
    
      Note that `alt` should have the *same shape* as `x`.
    
    
    Severity: Minor
    Found in tensorflow/python/keras/backend.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 unique_object_name has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def unique_object_name(name,
                           name_uid_map=None,
                           avoid_names=None,
                           namespace='',
                           zero_based=False,
    Severity: Minor
    Found in tensorflow/python/keras/backend.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 batch_set_value has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def batch_set_value(tuples):
      """Sets the values of many tensor variables at once.
    
      Args:
          tuples: a list of tuples `(tensor, value)`.
    Severity: Minor
    Found in tensorflow/python/keras/backend.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 _initialize_variables has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def _initialize_variables(session):
      """Utility to initialize uninitialized variables on the fly."""
      variables = _get_variables(get_graph())
      candidate_vars = []
      for v in variables:
    Severity: Minor
    Found in tensorflow/python/keras/backend.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 relu has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def relu(x, alpha=0., max_value=None, threshold=0):
      """Rectified linear unit.
    
      With default values, it returns element-wise `max(x, 0)`.
    
    
    Severity: Minor
    Found in tensorflow/python/keras/backend.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 conv2d_transpose has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def conv2d_transpose(x,
                         kernel,
                         output_shape,
                         strides=(1, 1),
                         padding='valid',
    Severity: Minor
    Found in tensorflow/python/keras/backend.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 rnn has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def rnn(step_function,
    Severity: Major
    Found in tensorflow/python/keras/backend.py - About 1 hr to fix

      Function _make_callable has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        def _make_callable(self, feed_arrays, feed_symbols, symbol_vals, session):
          """Generates a callable that runs the graph.
      
          Args:
            feed_arrays: List of input tensors to be fed Numpy arrays at runtime.
      Severity: Minor
      Found in tensorflow/python/keras/backend.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 _get_session has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def _get_session(op_input_list=()):
        """Returns the session object for the current thread."""
        global _SESSION
        default_session = ops.get_default_session()
        if default_session is not None:
      Severity: Minor
      Found in tensorflow/python/keras/backend.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 __call__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

        def __call__(self, inputs):
          inputs = nest.flatten(inputs, expand_composites=True)
      
          session = get_session(inputs)
          feed_arrays = []
      Severity: Minor
      Found in tensorflow/python/keras/backend.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 configure_and_create_distributed_session has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def configure_and_create_distributed_session(distribution_strategy):
        """Configure session config and create a session with it."""
      
        def _create_session(distribution_strategy):
          """Create the Distributed Strategy session."""
      Severity: Minor
      Found in tensorflow/python/keras/backend.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 resize_images has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def resize_images(x, height_factor, width_factor, data_format,
                        interpolation='nearest'):
        """Resizes the images contained in a 4D tensor.
      
        Args:
      Severity: Minor
      Found in tensorflow/python/keras/backend.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 pool2d has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def pool2d(x,
                 pool_size,
                 strides=(1, 1),
                 padding='valid',
                 data_format=None,
      Severity: Minor
      Found in tensorflow/python/keras/backend.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 batch_dot has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def batch_dot(x, y, axes=None):
        """Batchwise dot product.
      
        `batch_dot` is used to compute dot product of `x` and `y` when
        `x` and `y` are data in batch, i.e. in a shape of
      Severity: Minor
      Found in tensorflow/python/keras/backend.py - About 1 hr to fix

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

        def deprecated_internal_learning_phase_scope(value):
          """An internal-only version of `learning_phase_scope`.
        
          Unlike the public method, this method does not raise a deprecation warning.
          This is needed because saved model saving needs to set learning phase
        Severity: Minor
        Found in tensorflow/python/keras/backend.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 bias_add has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def bias_add(x, bias, data_format=None):
          """Adds a bias vector to a tensor.
        
          Args:
              x: Tensor or variable.
        Severity: Minor
        Found in tensorflow/python/keras/backend.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 local_conv has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def local_conv(inputs,
                       kernel,
                       kernel_size,
                       strides,
                       output_shape,
        Severity: Minor
        Found in tensorflow/python/keras/backend.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 separable_conv2d has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def separable_conv2d(x,
        Severity: Major
        Found in tensorflow/python/keras/backend.py - About 50 mins to fix

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

          def conv2d_transpose(x,
          Severity: Major
          Found in tensorflow/python/keras/backend.py - About 50 mins to fix

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

            def batch_normalization(x, mean, var, beta, gamma, axis=-1, epsilon=1e-3):
            Severity: Major
            Found in tensorflow/python/keras/backend.py - About 50 mins to fix

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

              def separable_conv1d(x,
              Severity: Major
              Found in tensorflow/python/keras/backend.py - About 50 mins to fix

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

                def conv3d_transpose(x,
                Severity: Minor
                Found in tensorflow/python/keras/backend.py - About 45 mins to fix

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

                  def _broadcast_normalize_batch_in_training(x,
                                                             gamma,
                                                             beta,
                                                             reduction_axes,
                                                             epsilon=1e-3):
                  Severity: Minor
                  Found in tensorflow/python/keras/backend.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 conv2d has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def conv2d(x,
                  Severity: Minor
                  Found in tensorflow/python/keras/backend.py - About 45 mins to fix

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

                    def depthwise_conv2d(x,
                    Severity: Minor
                    Found in tensorflow/python/keras/backend.py - About 45 mins to fix

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

                      def local_conv(inputs,
                      Severity: Minor
                      Found in tensorflow/python/keras/backend.py - About 45 mins to fix

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

                        def random_normal_variable(shape, mean, scale, dtype=None, name=None,
                        Severity: Minor
                        Found in tensorflow/python/keras/backend.py - About 45 mins to fix

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

                          def random_uniform_variable(shape, low, high, dtype=None, name=None, seed=None):
                          Severity: Minor
                          Found in tensorflow/python/keras/backend.py - About 45 mins to fix

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

                            def conv1d(x,
                            Severity: Minor
                            Found in tensorflow/python/keras/backend.py - About 45 mins to fix

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

                              def pool3d(x,
                              Severity: Minor
                              Found in tensorflow/python/keras/backend.py - About 45 mins to fix

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

                                  def __init__(self, inputs, outputs, updates=None, name=None,
                                               **session_kwargs):
                                    updates = updates or []
                                    if not isinstance(updates, (list, tuple)):
                                      raise TypeError('`updates` in a Keras backend function '
                                Severity: Minor
                                Found in tensorflow/python/keras/backend.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 conv3d has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                def conv3d(x,
                                Severity: Minor
                                Found in tensorflow/python/keras/backend.py - About 45 mins to fix

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

                                  def placeholder(shape=None,
                                  Severity: Minor
                                  Found in tensorflow/python/keras/backend.py - About 45 mins to fix

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

                                    def unique_object_name(name,
                                    Severity: Minor
                                    Found in tensorflow/python/keras/backend.py - About 45 mins to fix

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

                                      def pool2d(x,
                                      Severity: Minor
                                      Found in tensorflow/python/keras/backend.py - About 45 mins to fix

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

                                        def local_conv2d(inputs,
                                        Severity: Minor
                                        Found in tensorflow/python/keras/backend.py - About 45 mins to fix

                                          Avoid deeply nested control flow statements.
                                          Open

                                                    if hasattr(x, '_assign_placeholder'):
                                                      assign_placeholder = x._assign_placeholder
                                                      assign_op = x._assign_op
                                                    else:
                                                      # In order to support assigning weights to resizable variables in
                                          Severity: Major
                                          Found in tensorflow/python/keras/backend.py - About 45 mins to fix

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

                                            def separable_conv1d(x,
                                                                 depthwise_kernel,
                                                                 pointwise_kernel,
                                                                 strides=1,
                                                                 padding='valid',
                                            Severity: Minor
                                            Found in tensorflow/python/keras/backend.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 pool3d has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                            def pool3d(x,
                                                       pool_size,
                                                       strides=(1, 1, 1),
                                                       padding='valid',
                                                       data_format=None,
                                            Severity: Minor
                                            Found in tensorflow/python/keras/backend.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

                                            Avoid deeply nested control flow statements.
                                            Open

                                                      if shape[i] is None:
                                                        ragged_rank = i
                                                    type_spec = ragged_tensor.RaggedTensorSpec(
                                            Severity: Major
                                            Found in tensorflow/python/keras/backend.py - About 45 mins to fix

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

                                              def conv3d_transpose(x,
                                                                   kernel,
                                                                   output_shape,
                                                                   strides=(1, 1, 1),
                                                                   padding='valid',
                                              Severity: Minor
                                              Found in tensorflow/python/keras/backend.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

                                              Consider simplifying this complex logical expression.
                                              Open

                                                  if (self._callable_fn is None or feed_arrays != self._feed_arrays or
                                                      symbol_vals != self._symbol_vals or
                                                      feed_symbols != self._feed_symbols or self.fetches != self._fetches or
                                                      session != self._session):
                                                    self._make_callable(feed_arrays, feed_symbols, symbol_vals, session)
                                              Severity: Major
                                              Found in tensorflow/python/keras/backend.py - About 40 mins to fix

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

                                                def random_normal(shape, mean=0.0, stddev=1.0, dtype=None, seed=None):
                                                Severity: Minor
                                                Found in tensorflow/python/keras/backend.py - About 35 mins to fix

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

                                                  def function(inputs, outputs, updates=None, name=None, **kwargs):
                                                  Severity: Minor
                                                  Found in tensorflow/python/keras/backend.py - About 35 mins to fix

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

                                                    def ctc_decode(y_pred, input_length, greedy=True, beam_width=100, top_paths=1):
                                                    Severity: Minor
                                                    Found in tensorflow/python/keras/backend.py - About 35 mins to fix

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

                                                      def resize_volumes(x, depth_factor, height_factor, width_factor, data_format):
                                                      Severity: Minor
                                                      Found in tensorflow/python/keras/backend.py - About 35 mins to fix

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

                                                        def random_uniform(shape, minval=0.0, maxval=1.0, dtype=None, seed=None):
                                                        Severity: Minor
                                                        Found in tensorflow/python/keras/backend.py - About 35 mins to fix

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

                                                          def resize_images(x, height_factor, width_factor, data_format,
                                                          Severity: Minor
                                                          Found in tensorflow/python/keras/backend.py - About 35 mins to fix

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

                                                            def _regular_normalize_batch_in_training(x,
                                                            Severity: Minor
                                                            Found in tensorflow/python/keras/backend.py - About 35 mins to fix

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

                                                              def _fused_normalize_batch_in_training(x,
                                                              Severity: Minor
                                                              Found in tensorflow/python/keras/backend.py - About 35 mins to fix

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

                                                                  def __init__(self, inputs, outputs, updates=None, name=None,
                                                                Severity: Minor
                                                                Found in tensorflow/python/keras/backend.py - About 35 mins to fix

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

                                                                  def truncated_normal(shape, mean=0.0, stddev=1.0, dtype=None, seed=None):
                                                                  Severity: Minor
                                                                  Found in tensorflow/python/keras/backend.py - About 35 mins to fix

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

                                                                    def local_conv1d(inputs, kernel, kernel_size, strides, data_format=None):
                                                                    Severity: Minor
                                                                    Found in tensorflow/python/keras/backend.py - About 35 mins to fix

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

                                                                      def _broadcast_normalize_batch_in_training(x,
                                                                      Severity: Minor
                                                                      Found in tensorflow/python/keras/backend.py - About 35 mins to fix

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

                                                                        def normalize_batch_in_training(x, gamma, beta, reduction_axes, epsilon=1e-3):
                                                                        Severity: Minor
                                                                        Found in tensorflow/python/keras/backend.py - About 35 mins to fix

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

                                                                          def concatenate(tensors, axis=-1):
                                                                            """Concatenates a list of tensors alongside the specified axis.
                                                                          
                                                                            Args:
                                                                                tensors: list of tensors to concatenate.
                                                                          Severity: Minor
                                                                          Found in tensorflow/python/keras/backend.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 normalize_batch_in_training has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                          Open

                                                                          def normalize_batch_in_training(x, gamma, beta, reduction_axes, epsilon=1e-3):
                                                                            """Computes mean and std for batch then apply batch_normalization on batch.
                                                                          
                                                                            Args:
                                                                                x: Input tensor or variable.
                                                                          Severity: Minor
                                                                          Found in tensorflow/python/keras/backend.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 separable_conv2d has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                          Open

                                                                          def separable_conv2d(x,
                                                                                               depthwise_kernel,
                                                                                               pointwise_kernel,
                                                                                               strides=(1, 1),
                                                                                               padding='valid',
                                                                          Severity: Minor
                                                                          Found in tensorflow/python/keras/backend.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

                                                                          Avoid too many return statements within this function.
                                                                          Open

                                                                            return x
                                                                          Severity: Major
                                                                          Found in tensorflow/python/keras/backend.py - About 30 mins to fix

                                                                            Avoid too many return statements within this function.
                                                                            Open

                                                                                return x.eval(session=get_session((x,)))
                                                                            Severity: Major
                                                                            Found in tensorflow/python/keras/backend.py - About 30 mins to fix

                                                                              Avoid too many return statements within this function.
                                                                              Open

                                                                                return nn.bias_add(x, bias)
                                                                              Severity: Major
                                                                              Found in tensorflow/python/keras/backend.py - About 30 mins to fix

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

                                                                                def clip(x, min_value, max_value):
                                                                                  """Element-wise value clipping.
                                                                                
                                                                                  Args:
                                                                                      x: Tensor or variable.
                                                                                Severity: Minor
                                                                                Found in tensorflow/python/keras/backend.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

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

                                                                                def binary_crossentropy(target, output, from_logits=False):
                                                                                  """Binary crossentropy between an output tensor and a target tensor.
                                                                                
                                                                                  Args:
                                                                                      target: A tensor with the same shape as `output`.
                                                                                Severity: Minor
                                                                                Found in tensorflow/python/keras/backend.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

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

                                                                                def categorical_crossentropy(target, output, from_logits=False, axis=-1):
                                                                                  """Categorical crossentropy between an output tensor and a target tensor.
                                                                                
                                                                                  Args:
                                                                                      target: A tensor of the same shape as `output`.
                                                                                Severity: Minor
                                                                                Found in tensorflow/python/keras/backend.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

                                                                                @doc_controls.do_not_generate_docs
                                                                                def random_normal_variable(shape, mean, scale, dtype=None, name=None,
                                                                                                           seed=None):
                                                                                  """Instantiates a variable with values drawn from a normal distribution.
                                                                                
                                                                                
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 7 hrs to fix
                                                                                tensorflow/python/keras/backend.py on lines 1693..1724

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

                                                                                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

                                                                                @doc_controls.do_not_generate_docs
                                                                                def random_uniform_variable(shape, low, high, dtype=None, name=None, seed=None):
                                                                                  """Instantiates a variable with values drawn from a uniform distribution.
                                                                                
                                                                                  Args:
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 7 hrs to fix
                                                                                tensorflow/python/keras/backend.py on lines 1727..1759

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

                                                                                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

                                                                                @doc_controls.do_not_generate_docs
                                                                                def zeros(shape, dtype=None, name=None):
                                                                                  """Instantiates an all-zeros variable and returns it.
                                                                                
                                                                                  Args:
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 5 hrs to fix
                                                                                tensorflow/python/keras/backend.py on lines 1563..1595

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

                                                                                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

                                                                                @dispatch.add_dispatch_support
                                                                                @doc_controls.do_not_generate_docs
                                                                                def ones(shape, dtype=None, name=None):
                                                                                  """Instantiates an all-ones variable and returns it.
                                                                                
                                                                                
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 5 hrs to fix
                                                                                tensorflow/python/keras/backend.py on lines 1519..1560

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

                                                                                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

                                                                                @dispatch.add_dispatch_support
                                                                                @doc_controls.do_not_generate_docs
                                                                                def random_uniform(shape, minval=0.0, maxval=1.0, dtype=None, seed=None):
                                                                                  """Returns a tensor with uniform distribution of values.
                                                                                
                                                                                
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 5 hrs to fix
                                                                                tensorflow/python/keras/backend.py on lines 5875..5908

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

                                                                                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

                                                                                @dispatch.add_dispatch_support
                                                                                @doc_controls.do_not_generate_docs
                                                                                def random_normal(shape, mean=0.0, stddev=1.0, dtype=None, seed=None):
                                                                                  """Returns a tensor with normal distribution of values.
                                                                                
                                                                                
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 5 hrs to fix
                                                                                tensorflow/python/keras/backend.py on lines 5912..5941

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

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                      if hasattr(x, '_assign_placeholder'):
                                                                                        assign_placeholder = x._assign_placeholder
                                                                                        assign_op = x._assign_op
                                                                                      else:
                                                                                        # In order to support assigning weights to resizable variables in
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 4 hrs to fix
                                                                                tensorflow/python/keras/backend.py on lines 3707..3720

                                                                                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

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

                                                                                          if hasattr(x, '_assign_placeholder'):
                                                                                            assign_placeholder = x._assign_placeholder
                                                                                            assign_op = x._assign_op
                                                                                          else:
                                                                                            # In order to support assigning weights to resizable variables in
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 4 hrs to fix
                                                                                tensorflow/python/keras/backend.py on lines 3670..3683

                                                                                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

                                                                                  if tf_data_format == 'NDHWC':
                                                                                    strides = (1,) + strides + (1,)
                                                                                    pool_size = (1,) + pool_size + (1,)
                                                                                  else:
                                                                                    strides = (1, 1) + strides
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 4 hrs to fix
                                                                                tensorflow/python/keras/backend.py on lines 5600..5605

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

                                                                                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 tf_data_format == 'NHWC':
                                                                                    strides = (1,) + strides + (1,)
                                                                                    pool_size = (1,) + pool_size + (1,)
                                                                                  else:
                                                                                    strides = (1, 1) + strides
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 4 hrs to fix
                                                                                tensorflow/python/keras/backend.py on lines 5654..5659

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

                                                                                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 pool_mode == 'max':
                                                                                    x = nn.max_pool3d(
                                                                                        x, pool_size, strides, padding=padding, data_format=tf_data_format)
                                                                                  elif pool_mode == 'avg':
                                                                                    x = nn.avg_pool3d(
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 4 hrs to fix
                                                                                tensorflow/python/keras/backend.py on lines 5607..5614

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

                                                                                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 pool_mode == 'max':
                                                                                    x = nn.max_pool(
                                                                                        x, pool_size, strides, padding=padding, data_format=tf_data_format)
                                                                                  elif pool_mode == 'avg':
                                                                                    x = nn.avg_pool(
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 4 hrs to fix
                                                                                tensorflow/python/keras/backend.py on lines 5661..5668

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

                                                                                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 i, s in zip(int_shape(x), array_ops_stack.unstack(array_ops.shape(x))):
                                                                                      if i is not None:
                                                                                        x_shape.append(i)
                                                                                      else:
                                                                                        x_shape.append(s)
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 2 hrs to fix
                                                                                tensorflow/python/keras/backend.py on lines 1946..1950

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

                                                                                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 i, s in zip(int_shape(y), array_ops_stack.unstack(array_ops.shape(y))):
                                                                                      if i is not None:
                                                                                        y_shape.append(i)
                                                                                      else:
                                                                                        y_shape.append(s)
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 2 hrs to fix
                                                                                tensorflow/python/keras/backend.py on lines 1939..1943

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

                                                                                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

                                                                                @doc_controls.do_not_generate_docs
                                                                                def var(x, axis=None, keepdims=False):
                                                                                  """Variance of a tensor, alongside the specified axis.
                                                                                
                                                                                  Args:
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 2 hrs to fix
                                                                                tensorflow/python/keras/backend.py on lines 2349..2373

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

                                                                                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

                                                                                @dispatch.add_dispatch_support
                                                                                @doc_controls.do_not_generate_docs
                                                                                def std(x, axis=None, keepdims=False):
                                                                                  """Standard deviation of a tensor, alongside the specified axis.
                                                                                
                                                                                
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 2 hrs to fix
                                                                                tensorflow/python/keras/backend.py on lines 2329..2346

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

                                                                                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 beta is None:
                                                                                        beta = zeros_like(mean)
                                                                                      elif ndim(beta) > 1:
                                                                                        beta = array_ops.reshape(beta, [-1])
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 2958..2961

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

                                                                                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 gamma is None:
                                                                                        gamma = ones_like(mean)
                                                                                      elif ndim(gamma) > 1:
                                                                                        gamma = array_ops.reshape(gamma, [-1])
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 2954..2957

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

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  if tf_data_format == 'NHWC':
                                                                                    strides = (1,) + strides + (1,)
                                                                                  else:
                                                                                    strides = (1, 1) + strides
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 3 other locations - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 5390..5393
                                                                                tensorflow/python/keras/backend.py on lines 5441..5444
                                                                                tensorflow/python/keras/backend.py on lines 5544..5547

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 46.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  if tf_data_format == 'NDHWC':
                                                                                    strides = (1,) + strides + (1,)
                                                                                  else:
                                                                                    strides = (1, 1) + strides
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 3 other locations - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 5261..5264
                                                                                tensorflow/python/keras/backend.py on lines 5390..5393
                                                                                tensorflow/python/keras/backend.py on lines 5441..5444

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 46.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  if tf_data_format == 'NHWC':
                                                                                    strides = (1,) + strides + (1,)
                                                                                  else:
                                                                                    strides = (1, 1) + strides
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 3 other locations - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 5261..5264
                                                                                tensorflow/python/keras/backend.py on lines 5441..5444
                                                                                tensorflow/python/keras/backend.py on lines 5544..5547

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 46.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  if tf_data_format == 'NHWC':
                                                                                    strides = (1,) + strides + (1,)
                                                                                  else:
                                                                                    strides = (1, 1) + strides
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 3 other locations - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 5261..5264
                                                                                tensorflow/python/keras/backend.py on lines 5390..5393
                                                                                tensorflow/python/keras/backend.py on lines 5544..5547

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 46.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                @dispatch.add_dispatch_support
                                                                                @doc_controls.do_not_generate_docs
                                                                                def all(x, axis=None, keepdims=False):
                                                                                  """Bitwise reduction (logical AND).
                                                                                
                                                                                
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 2397..2411

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 46.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  if (not isinstance(output, (ops.EagerTensor, variables_module.Variable)) and
                                                                                      output.op.type == 'Softmax') and not hasattr(output, '_keras_history'):
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 4906..4907

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 46.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  if data_format == 'channels_first':
                                                                                    output = repeat_elements(x, depth_factor, axis=2)
                                                                                    output = repeat_elements(output, height_factor, axis=3)
                                                                                    output = repeat_elements(output, width_factor, axis=4)
                                                                                    return output
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 3155..3159

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 46.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  if (not isinstance(output, (ops.EagerTensor, variables_module.Variable)) and
                                                                                      output.op.type == 'Sigmoid') and not hasattr(output, '_keras_history'):
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 4762..4763

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 46.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                @dispatch.add_dispatch_support
                                                                                @doc_controls.do_not_generate_docs
                                                                                def any(x, axis=None, keepdims=False):
                                                                                  """Bitwise reduction (logical OR).
                                                                                
                                                                                
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 2414..2428

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 46.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  elif data_format == 'channels_last':
                                                                                    output = repeat_elements(x, depth_factor, axis=1)
                                                                                    output = repeat_elements(output, height_factor, axis=2)
                                                                                    output = repeat_elements(output, width_factor, axis=3)
                                                                                    return output
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 3150..3154

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 46.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                @dispatch.add_dispatch_support
                                                                                @doc_controls.do_not_generate_docs
                                                                                def reverse(x, axes):
                                                                                  """Reverse a tensor along the specified axes.
                                                                                
                                                                                
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 3301..3316

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 43.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                @dispatch.add_dispatch_support
                                                                                @doc_controls.do_not_generate_docs
                                                                                def tile(x, n):
                                                                                  """Creates a tensor by tiling `x` by `n`.
                                                                                
                                                                                
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 3543..3558

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 43.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                    raise ValueError('Cannot do batch_dot on inputs with shapes ' +
                                                                                                     str(x_shape) + ' and ' + str(y_shape) +
                                                                                                     ' with axes=' + str(axes) + '. x.shape[%d] != '
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 1 hr to fix
                                                                                tensorflow/python/grappler/cost_analyzer.py on lines 78..78

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 43.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  if gamma is None:
                                                                                    gamma = constant_op.constant(
                                                                                        1.0, dtype=x.dtype, shape=[x.shape[normalization_axis]])
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 2878..2880

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 40.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  if beta is None:
                                                                                    beta = constant_op.constant(
                                                                                        0.0, dtype=x.dtype, shape=[x.shape[normalization_axis]])
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 2875..2877

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 40.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  if data_format == 'channels_first' and tf_data_format == 'NDHWC':
                                                                                    x = array_ops.transpose(x, (0, 4, 1, 2, 3))
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 2 other locations - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 5497..5498
                                                                                tensorflow/python/keras/backend.py on lines 5670..5671

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

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  if data_format == 'channels_first' and tf_data_format == 'NDHWC':
                                                                                    x = array_ops.transpose(x, (0, 4, 1, 2, 3))
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 2 other locations - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 5556..5557
                                                                                tensorflow/python/keras/backend.py on lines 5670..5671

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

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  if data_format == 'channels_first' and tf_data_format == 'NDHWC':
                                                                                    x = array_ops.transpose(x, (0, 4, 1, 2, 3))
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 2 other locations - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 5497..5498
                                                                                tensorflow/python/keras/backend.py on lines 5556..5557

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

                                                                                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 x_batch_size != y_batch_size:
                                                                                      raise ValueError('Cannot do batch_dot on inputs '
                                                                                                       'with different batch sizes. '
                                                                                                       'Received inputs with shapes ' +
                                                                                                       str(x_shape) + ' and ' +
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 2018..2023

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

                                                                                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 x_ndim < 2 or y_ndim < 2:
                                                                                    raise ValueError('Cannot do batch_dot on inputs '
                                                                                                     'with rank < 2. '
                                                                                                     'Received inputs with shapes ' +
                                                                                                     str(x_shape) + ' and ' +
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 2029..2034

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

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  if data_format == 'channels_first' and tf_data_format == 'NHWC':
                                                                                    x = array_ops.transpose(x, (0, 3, 1, 2))  # NHWC -> NCHW
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 4 other locations - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 5204..5205
                                                                                tensorflow/python/keras/backend.py on lines 5278..5279
                                                                                tensorflow/python/keras/backend.py on lines 5453..5454
                                                                                tensorflow/python/keras/backend.py on lines 5616..5617

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 38.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  if data_format == 'channels_first' and tf_data_format == 'NHWC':
                                                                                    x = array_ops.transpose(x, (0, 3, 1, 2))  # NHWC -> NCHW
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 4 other locations - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 5204..5205
                                                                                tensorflow/python/keras/backend.py on lines 5278..5279
                                                                                tensorflow/python/keras/backend.py on lines 5403..5404
                                                                                tensorflow/python/keras/backend.py on lines 5453..5454

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 38.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  if data_format == 'channels_first' and tf_data_format == 'NHWC':
                                                                                    x = array_ops.transpose(x, (0, 3, 1, 2))  # NHWC -> NCHW
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 4 other locations - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 5278..5279
                                                                                tensorflow/python/keras/backend.py on lines 5403..5404
                                                                                tensorflow/python/keras/backend.py on lines 5453..5454
                                                                                tensorflow/python/keras/backend.py on lines 5616..5617

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 38.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  if data_format == 'channels_first' and tf_data_format == 'NHWC':
                                                                                    x = array_ops.transpose(x, (0, 3, 1, 2))  # NHWC -> NCHW
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 4 other locations - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 5204..5205
                                                                                tensorflow/python/keras/backend.py on lines 5403..5404
                                                                                tensorflow/python/keras/backend.py on lines 5453..5454
                                                                                tensorflow/python/keras/backend.py on lines 5616..5617

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 38.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  if data_format == 'channels_first' and tf_data_format == 'NHWC':
                                                                                    x = array_ops.transpose(x, (0, 3, 1, 2))  # NHWC -> NCHW
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 4 other locations - About 1 hr to fix
                                                                                tensorflow/python/keras/backend.py on lines 5204..5205
                                                                                tensorflow/python/keras/backend.py on lines 5278..5279
                                                                                tensorflow/python/keras/backend.py on lines 5403..5404
                                                                                tensorflow/python/keras/backend.py on lines 5616..5617

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 38.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  if data_format == 'channels_first' and tf_data_format == 'NWC':
                                                                                    x = array_ops.transpose(x, (0, 2, 1))  # NWC -> NCW
                                                                                Severity: Minor
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 55 mins to fix
                                                                                tensorflow/python/keras/backend.py on lines 5160..5161

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

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  if data_format == 'channels_first' and tf_data_format == 'NWC':
                                                                                    x = array_ops.transpose(x, (0, 2, 1))  # NWC -> NCW
                                                                                Severity: Minor
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 55 mins to fix
                                                                                tensorflow/python/keras/backend.py on lines 5344..5345

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

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                        for state, new_state in zip(flat_state, flat_new_state):
                                                                                          if isinstance(new_state, tensor_lib.Tensor):
                                                                                            new_state.set_shape(state.shape)
                                                                                Severity: Minor
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 50 mins to fix
                                                                                tensorflow/python/keras/backend.py on lines 4369..4371

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 36.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                        for state, new_state in zip(flat_state, flat_new_state):
                                                                                          if isinstance(new_state, tensor_lib.Tensor):
                                                                                            new_state.set_shape(state.shape)
                                                                                Severity: Minor
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 50 mins to fix
                                                                                tensorflow/python/keras/backend.py on lines 4406..4408

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 36.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                @doc_controls.do_not_generate_docs
                                                                                def foldr(fn, elems, initializer=None, name=None):
                                                                                  """Reduce elems using fn to combine them from right to left.
                                                                                
                                                                                  Args:
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 2 other locations - About 50 mins to fix
                                                                                tensorflow/python/keras/backend.py on lines 6174..6187
                                                                                tensorflow/python/keras/backend.py on lines 6190..6204

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 36.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                @doc_controls.do_not_generate_docs
                                                                                def foldl(fn, elems, initializer=None, name=None):
                                                                                  """Reduce elems using fn to combine them from left to right.
                                                                                
                                                                                  Args:
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 2 other locations - About 50 mins to fix
                                                                                tensorflow/python/keras/backend.py on lines 6174..6187
                                                                                tensorflow/python/keras/backend.py on lines 6207..6221

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 36.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                @doc_controls.do_not_generate_docs
                                                                                def map_fn(fn, elems, name=None, dtype=None):
                                                                                  """Map the function fn over the elements elems and return the outputs.
                                                                                
                                                                                  Args:
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 2 other locations - About 50 mins to fix
                                                                                tensorflow/python/keras/backend.py on lines 6190..6204
                                                                                tensorflow/python/keras/backend.py on lines 6207..6221

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 36.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  if hasattr(output, '_keras_logits'):
                                                                                    output = output._keras_logits  # pylint: disable=protected-access
                                                                                    if from_logits:
                                                                                      warnings.warn(
                                                                                          '"`categorical_crossentropy` received `from_logits=True`, but '
                                                                                Severity: Minor
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 40 mins to fix
                                                                                tensorflow/python/keras/backend.py on lines 4894..4901

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

                                                                                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 hasattr(output, '_keras_logits'):
                                                                                    output = output._keras_logits  # pylint: disable=protected-access
                                                                                    if from_logits:
                                                                                      warnings.warn(
                                                                                          '"`binary_crossentropy` received `from_logits=True`, but the `output`'
                                                                                Severity: Minor
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 40 mins to fix
                                                                                tensorflow/python/keras/backend.py on lines 4749..4756

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

                                                                                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

                                                                                    y, _, _ = nn.fused_batch_norm(
                                                                                        x,
                                                                                        gamma,
                                                                                        beta,
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 4 other locations - About 35 mins to fix
                                                                                tensorflow/python/ops/nn_fused_batchnorm_test.py on lines 253..256
                                                                                tensorflow/python/ops/nn_fused_batchnorm_test.py on lines 270..273
                                                                                tensorflow/python/ops/nn_fused_batchnorm_test.py on lines 323..326
                                                                                tensorflow/python/ops/nn_fused_batchnorm_test.py on lines 365..368

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 33.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  y_pred = math_ops.log(array_ops.transpose(y_pred, perm=[1, 0, 2]) + epsilon())
                                                                                Severity: Minor
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 35 mins to fix
                                                                                tensorflow/python/keras/backend.py on lines 6110..6110

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 33.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                  y_pred = math_ops.log(array_ops.transpose(y_pred, perm=[1, 0, 2]) + epsilon())
                                                                                Severity: Minor
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 35 mins to fix
                                                                                tensorflow/python/keras/backend.py on lines 6150..6150

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 33.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                    if cond_ndim > expr_ndim:
                                                                                      raise ValueError('Rank of `condition` should be less than or'
                                                                                                       ' equal to rank of `then_expression` and '
                                                                                                       '`else_expression`. ndim(condition)=' + str(cond_ndim) +
                                                                                                       ', ndim(then_expression)'
                                                                                Severity: Minor
                                                                                Found in tensorflow/python/keras/backend.py and 2 other locations - About 35 mins to fix
                                                                                tensorflow/python/keras/engine/training_v1.py on lines 2556..2560
                                                                                tensorflow/python/keras/layers/merge.py on lines 78..81

                                                                                Duplicated Code

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

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

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

                                                                                Tuning

                                                                                This issue has a mass of 33.

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

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

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

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

                                                                                Refactorings

                                                                                Further Reading

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

                                                                                @dispatch.add_dispatch_support
                                                                                @doc_controls.do_not_generate_docs
                                                                                def min(x, axis=None, keepdims=False):
                                                                                  """Minimum value in a tensor.
                                                                                
                                                                                
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 3 other locations - About 30 mins to fix
                                                                                tensorflow/python/keras/backend.py on lines 2223..2239
                                                                                tensorflow/python/keras/backend.py on lines 2261..2277
                                                                                tensorflow/python/keras/backend.py on lines 2280..2296

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

                                                                                @dispatch.add_dispatch_support
                                                                                @doc_controls.do_not_generate_docs
                                                                                def prod(x, axis=None, keepdims=False):
                                                                                  """Multiplies the values in a tensor, alongside the specified axis.
                                                                                
                                                                                
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 3 other locations - About 30 mins to fix
                                                                                tensorflow/python/keras/backend.py on lines 2223..2239
                                                                                tensorflow/python/keras/backend.py on lines 2242..2258
                                                                                tensorflow/python/keras/backend.py on lines 2261..2277

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

                                                                                @dispatch.add_dispatch_support
                                                                                @doc_controls.do_not_generate_docs
                                                                                def cumprod(x, axis=0):
                                                                                  """Cumulative product of the values in a tensor, alongside the specified axis.
                                                                                
                                                                                
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 3 other locations - About 30 mins to fix
                                                                                tensorflow/python/keras/backend.py on lines 2299..2311
                                                                                tensorflow/python/keras/backend.py on lines 3496..3520
                                                                                tensorflow/python/keras/backend.py on lines 4655..4668

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

                                                                                @dispatch.add_dispatch_support
                                                                                @doc_controls.do_not_generate_docs
                                                                                def cumsum(x, axis=0):
                                                                                  """Cumulative sum of the values in a tensor, alongside the specified axis.
                                                                                
                                                                                
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 3 other locations - About 30 mins to fix
                                                                                tensorflow/python/keras/backend.py on lines 2314..2326
                                                                                tensorflow/python/keras/backend.py on lines 3496..3520
                                                                                tensorflow/python/keras/backend.py on lines 4655..4668

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

                                                                                @dispatch.add_dispatch_support
                                                                                @doc_controls.do_not_generate_docs
                                                                                def softmax(x, axis=-1):
                                                                                  """Softmax of a tensor.
                                                                                
                                                                                
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 3 other locations - About 30 mins to fix
                                                                                tensorflow/python/keras/backend.py on lines 2299..2311
                                                                                tensorflow/python/keras/backend.py on lines 2314..2326
                                                                                tensorflow/python/keras/backend.py on lines 3496..3520

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

                                                                                @dispatch.add_dispatch_support
                                                                                @doc_controls.do_not_generate_docs
                                                                                def max(x, axis=None, keepdims=False):
                                                                                  """Maximum value in a tensor.
                                                                                
                                                                                
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 3 other locations - About 30 mins to fix
                                                                                tensorflow/python/keras/backend.py on lines 2242..2258
                                                                                tensorflow/python/keras/backend.py on lines 2261..2277
                                                                                tensorflow/python/keras/backend.py on lines 2280..2296

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

                                                                                @dispatch.add_dispatch_support
                                                                                @doc_controls.do_not_generate_docs
                                                                                def stack(x, axis=0):
                                                                                  """Stacks a list of rank `R` tensors into a rank `R+1` tensor.
                                                                                
                                                                                
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 3 other locations - About 30 mins to fix
                                                                                tensorflow/python/keras/backend.py on lines 2299..2311
                                                                                tensorflow/python/keras/backend.py on lines 2314..2326
                                                                                tensorflow/python/keras/backend.py on lines 4655..4668

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

                                                                                @dispatch.add_dispatch_support
                                                                                @doc_controls.do_not_generate_docs
                                                                                def sum(x, axis=None, keepdims=False):
                                                                                  """Sum of the values in a tensor, alongside the specified axis.
                                                                                
                                                                                
                                                                                Severity: Major
                                                                                Found in tensorflow/python/keras/backend.py and 3 other locations - About 30 mins to fix
                                                                                tensorflow/python/keras/backend.py on lines 2223..2239
                                                                                tensorflow/python/keras/backend.py on lines 2242..2258
                                                                                tensorflow/python/keras/backend.py on lines 2280..2296

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

                                                                                        output_ta_t = tuple(
                                                                                            ta.write(time, out)
                                                                                            for ta, out in zip(output_ta_t, flat_new_output))
                                                                                Severity: Minor
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 30 mins to fix
                                                                                tensorflow/python/keras/backend.py on lines 4411..4412

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

                                                                                        output_ta_t = tuple(
                                                                                            ta.write(time, out) for ta, out in zip(output_ta_t, flat_output))
                                                                                Severity: Minor
                                                                                Found in tensorflow/python/keras/backend.py and 1 other location - About 30 mins to fix
                                                                                tensorflow/python/keras/backend.py on lines 4376..4378

                                                                                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