tensorflow/tensorflow

View on GitHub
tensorflow/python/ops/array_ops.py

Summary

Maintainability
F
2 wks
Test Coverage

File array_ops.py has 5079 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/ops/array_ops.py - About 2 wks to fix

    Function shape_internal has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def shape_internal(input, name=None, optimize=True, out_type=None):
      # pylint: disable=redefined-builtin
      """Returns the shape of a tensor.
    
      If `out_type` is not specified and the shape is fully known, then we look at
    Severity: Minor
    Found in tensorflow/python/ops/array_ops.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 size_internal has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def size_internal(input, name=None, optimize=True, out_type=dtypes.int32):
      # pylint: disable=redefined-builtin,protected-access
      """Returns the size of a tensor.
    
      Args:
    Severity: Minor
    Found in tensorflow/python/ops/array_ops.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 quantize_v2 has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def quantize_v2(
    Severity: Major
    Found in tensorflow/python/ops/array_ops.py - About 1 hr to fix

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

      def quantize(
      Severity: Major
      Found in tensorflow/python/ops/array_ops.py - About 1 hr to fix

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

        def quantize_and_dequantize_v2(
        Severity: Major
        Found in tensorflow/python/ops/array_ops.py - About 1 hr to fix

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

          def quantize_and_dequantize(
          Severity: Major
          Found in tensorflow/python/ops/array_ops.py - About 1 hr to fix

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

            def strided_slice(input_,
            Severity: Major
            Found in tensorflow/python/ops/array_ops.py - About 1 hr to fix

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

              def _autopacking_helper(list_or_tuple, dtype, name):
                """Converts the given list or tuple to a tensor by packing.
              
                Args:
                  list_or_tuple: A (possibly nested) list or tuple containing a tensor.
              Severity: Minor
              Found in tensorflow/python/ops/array_ops.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 dequantize has 10 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def dequantize(  # pylint: disable=missing-docstring
              Severity: Major
              Found in tensorflow/python/ops/array_ops.py - About 1 hr to fix

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

                def extract_image_patches(  # pylint: disable=missing-docstring
                Severity: Major
                Found in tensorflow/python/ops/array_ops.py - About 1 hr to fix

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

                  def matrix_diag(diagonal,
                  Severity: Major
                  Found in tensorflow/python/ops/array_ops.py - About 50 mins to fix

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

                    def space_to_batch(  # pylint: disable=missing-docstring
                    Severity: Major
                    Found in tensorflow/python/ops/array_ops.py - About 50 mins to fix

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

                      def one_hot(indices,
                      Severity: Major
                      Found in tensorflow/python/ops/array_ops.py - About 50 mins to fix

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

                        def reverse_sequence(input,
                        Severity: Major
                        Found in tensorflow/python/ops/array_ops.py - About 50 mins to fix

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

                          def array_like_impl(
                          Severity: Major
                          Found in tensorflow/python/ops/array_ops.py - About 50 mins to fix

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

                            def gather_v2(params,
                            Severity: Minor
                            Found in tensorflow/python/ops/array_ops.py - About 45 mins to fix

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

                              def matrix_diag_part(
                              Severity: Minor
                              Found in tensorflow/python/ops/array_ops.py - About 45 mins to fix

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

                                def extract_image_patches_v2(images, sizes, strides, rates, padding, name=None):
                                Severity: Minor
                                Found in tensorflow/python/ops/array_ops.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                            if not out_type:
                                              return constant_op._tensor_shape_tensor_conversion_function(  # pylint: disable=protected-access
                                                  input_shape)
                                            return constant(input_shape.as_list(), out_type, name=name)
                                  Severity: Major
                                  Found in tensorflow/python/ops/array_ops.py - About 45 mins to fix

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

                                    def matrix_set_diag(
                                    Severity: Minor
                                    Found in tensorflow/python/ops/array_ops.py - About 45 mins to fix

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

                                      def gather(params,
                                      Severity: Minor
                                      Found in tensorflow/python/ops/array_ops.py - About 45 mins to fix

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

                                        def ones_like_v2(
                                        Severity: Minor
                                        Found in tensorflow/python/ops/array_ops.py - About 35 mins to fix

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

                                          def zeros_like_v2(
                                          Severity: Minor
                                          Found in tensorflow/python/ops/array_ops.py - About 35 mins to fix

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

                                            def split(value, num_or_size_splits, axis=0, num=None, name="split"):
                                            Severity: Minor
                                            Found in tensorflow/python/ops/array_ops.py - About 35 mins to fix

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

                                              def pad_v2(tensor, paddings, mode="CONSTANT", constant_values=0, name=None):
                                              Severity: Minor
                                              Found in tensorflow/python/ops/array_ops.py - About 35 mins to fix

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

                                                def batch_to_space(input, crops, block_size, name=None, block_shape=None):  # pylint: disable=redefined-builtin,missing-docstring
                                                Severity: Minor
                                                Found in tensorflow/python/ops/array_ops.py - About 35 mins to fix

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

                                                  def reverse_sequence_v2(input,
                                                  Severity: Minor
                                                  Found in tensorflow/python/ops/array_ops.py - About 35 mins to fix

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

                                                    def pad(tensor, paddings, mode="CONSTANT", name=None, constant_values=0):  # pylint: disable=invalid-name
                                                    Severity: Minor
                                                    Found in tensorflow/python/ops/array_ops.py - About 35 mins to fix

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

                                                      def searchsorted(sorted_sequence,
                                                      Severity: Minor
                                                      Found in tensorflow/python/ops/array_ops.py - About 35 mins to fix

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

                                                        def _constant_if_small(value, shape, dtype, name, layout=None):
                                                        Severity: Minor
                                                        Found in tensorflow/python/ops/array_ops.py - About 35 mins to fix

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

                                                          def zeros_like_impl(tensor, dtype, name, optimize=True, layout=None):
                                                          Severity: Minor
                                                          Found in tensorflow/python/ops/array_ops.py - About 35 mins to fix

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

                                                            def ones_like_impl(tensor, dtype, name, optimize=True, layout=None):
                                                            Severity: Minor
                                                            Found in tensorflow/python/ops/array_ops.py - About 35 mins to fix

                                                              Avoid too many return statements within this function.
                                                              Open

                                                                    return gen_array_ops.size(input, name=name, out_type=out_type)
                                                              Severity: Major
                                                              Found in tensorflow/python/ops/array_ops.py - About 30 mins to fix

                                                                There are no issues that match your filters.

                                                                Category
                                                                Status