tensorflow/tensorflow

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

Summary

Maintainability
F
1 wk
Test Coverage

File sparse_ops.py has 2945 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/sparse_ops.py - About 1 wk to fix

    Function sparse_bincount has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def sparse_bincount(values,
                        weights=None,
                        axis=0,
                        minlength=None,
                        maxlength=None,
    Severity: Minor
    Found in tensorflow/python/ops/sparse_ops.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_merge_impl has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def sparse_merge_impl(sp_ids,
                          sp_values,
                          vocab_size,
                          name=None,
                          already_sorted=False):
    Severity: Minor
    Found in tensorflow/python/ops/sparse_ops.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 sparse_reshape has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def sparse_reshape(sp_input, shape, name=None):
      """Reshapes a `SparseTensor` to represent values in a new dense shape.
    
      This operation has the same semantics as `reshape` on the represented dense
      tensor.  The indices of non-empty values in `sp_input` are recomputed based
    Severity: Minor
    Found in tensorflow/python/ops/sparse_ops.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 sparse_concat_v2 has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def sparse_concat_v2(axis, sp_inputs, expand_nonconcat_dims=False, name=None):  # pylint: disable=missing-docstring
      sp_inputs = _convert_to_sparse_tensors(sp_inputs)
    
      if len(sp_inputs) == 1:  # Degenerate case of one tensor.
        return sp_inputs[0]
    Severity: Minor
    Found in tensorflow/python/ops/sparse_ops.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 bincount has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def bincount(arr: sparse_tensor.SparseTensor,
                 weights=None,
                 minlength=None,
                 maxlength=None,
                 dtype=dtypes.int32,
    Severity: Minor
    Found in tensorflow/python/ops/sparse_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 sparse_reset_shape has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def sparse_reset_shape(sp_input, new_shape=None):
      """Resets the shape of a `SparseTensor` with indices and values unchanged.
    
      If `new_shape` is None, returns a copy of `sp_input` with its shape reset
      to the tight bounding box of `sp_input`. This will be a shape consisting of
    Severity: Minor
    Found in tensorflow/python/ops/sparse_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 bincount has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def bincount(arr: sparse_tensor.SparseTensor,
    Severity: Major
    Found in tensorflow/python/ops/sparse_ops.py - About 1 hr to fix

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

      def sparse_transpose(sp_input, perm=None, name=None):
        """Transposes a `SparseTensor`.
      
        Permutes the dimensions according to the value of `perm`.  This is the sparse
        version of `tf.transpose`.
      Severity: Minor
      Found in tensorflow/python/ops/sparse_ops.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 _sparse_cross_internal_v2 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def _sparse_cross_internal_v2(inputs):
        """See gen_sparse_ops.sparse_cross_v2."""
        if not isinstance(inputs, (tuple, list)):
          raise TypeError("Inputs must be a list")
        if not all(
      Severity: Minor
      Found in tensorflow/python/ops/sparse_ops.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 _sparse_cross_internal has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def _sparse_cross_internal(inputs,
                                 hashed_output=False,
                                 num_buckets=0,
                                 hash_key=None,
                                 name=None):
      Severity: Minor
      Found in tensorflow/python/ops/sparse_ops.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 sparse_bincount has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def sparse_bincount(values,
      Severity: Major
      Found in tensorflow/python/ops/sparse_ops.py - About 50 mins to fix

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

        def sparse_concat(axis,
        Severity: Minor
        Found in tensorflow/python/ops/sparse_ops.py - About 45 mins to fix

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

          def sparse_split(keyword_required=KeywordRequired(),
          Severity: Minor
          Found in tensorflow/python/ops/sparse_ops.py - About 45 mins to fix

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

            def sparse_tensor_dense_matmul(sp_a,
                                           b,
                                           adjoint_a=False,
                                           adjoint_b=False,
                                           name=None):
            Severity: Minor
            Found in tensorflow/python/ops/sparse_ops.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 sparse_to_dense has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def sparse_to_dense(sparse_indices,
            Severity: Minor
            Found in tensorflow/python/ops/sparse_ops.py - About 45 mins to fix

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

              def sparse_merge_impl(sp_ids,
              Severity: Minor
              Found in tensorflow/python/ops/sparse_ops.py - About 35 mins to fix

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

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

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

                  def sparse_reduce_sum(sp_input, axis=None, keepdims=None,
                  Severity: Minor
                  Found in tensorflow/python/ops/sparse_ops.py - About 35 mins to fix

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

                    def sparse_reduce_max(sp_input, axis=None, keepdims=None,
                    Severity: Minor
                    Found in tensorflow/python/ops/sparse_ops.py - About 35 mins to fix

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

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

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

                        def _sparse_cross_internal(inputs,
                        Severity: Minor
                        Found in tensorflow/python/ops/sparse_ops.py - About 35 mins to fix

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

                          def sparse_reduce_max_sparse(sp_input,
                          Severity: Minor
                          Found in tensorflow/python/ops/sparse_ops.py - About 35 mins to fix

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

                            def sparse_reduce_sum_sparse(sp_input,
                            Severity: Minor
                            Found in tensorflow/python/ops/sparse_ops.py - About 35 mins to fix

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

                              def sparse_tensor_dense_matmul(sp_a,
                              Severity: Minor
                              Found in tensorflow/python/ops/sparse_ops.py - About 35 mins to fix

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

                                def sparse_merge(sp_ids, sp_values, vocab_size, name=None,
                                Severity: Minor
                                Found in tensorflow/python/ops/sparse_ops.py - About 35 mins to fix

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

                                  def sparse_add_v2(a, b, threshold=0):
                                    """Adds two tensors, at least one of each is a `SparseTensor`.
                                  
                                    If one `SparseTensor` and one `Tensor` are passed in, returns a `Tensor`.  If
                                    both arguments are `SparseTensor`s, this returns a `SparseTensor`.  The order
                                  Severity: Minor
                                  Found in tensorflow/python/ops/sparse_ops.py - About 35 mins to fix

                                  Cognitive Complexity

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

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

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

                                  Further reading

                                  There are no issues that match your filters.

                                  Category
                                  Status