tensorflow/models

View on GitHub

Showing 11,634 of 11,634 total issues

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

  def __init__(self,
Severity: Minor
Found in official/nlp/modeling/models/xlnet.py - About 45 mins to fix

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

      def build(self, input_shape):
        """Implements build() for the layer."""
        dimension_list = input_shape.as_list()
    
        if len(dimension_list) != 3:
    Severity: Minor
    Found in official/nlp/modeling/networks/packed_sequence_embedding.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 __call__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def __call__(self,
    Severity: Minor
    Found in official/nlp/modeling/models/t5.py - About 45 mins to fix

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

        def __init__(self,
      Severity: Minor
      Found in official/nlp/modeling/models/t5.py - About 45 mins to fix

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

          def __init__(self, *,
        Severity: Minor
        Found in official/nlp/modeling/layers/text_layers.py - About 45 mins to fix

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

            def test_attention_projection(
          Severity: Minor
          Found in official/nlp/modeling/layers/kernel_attention_test.py - About 45 mins to fix

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

              def __init__(self,
            Severity: Minor
            Found in official/nlp/modeling/layers/masked_lm.py - About 45 mins to fix

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

                def __init__(self,
              Severity: Minor
              Found in official/nlp/modeling/layers/bigbird_attention.py - About 45 mins to fix

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

                  def test_attention_no_projection(
                Severity: Minor
                Found in official/nlp/modeling/layers/kernel_attention_test.py - About 45 mins to fix

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

                    def _compute_attention(self,
                  Severity: Minor
                  Found in official/nlp/modeling/layers/reuse_attention.py - About 45 mins to fix

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

                      def __init__(self,
                    Severity: Minor
                    Found in official/nlp/modeling/layers/position_embedding.py - About 45 mins to fix

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

                      def causal_windowed_performer_attention(query_matrix,
                                                              key_matrix,
                                                              value_matrix,
                                                              chunk_length,
                                                              window_length,
                      Severity: Minor
                      Found in official/nlp/modeling/layers/kernel_attention.py - About 45 mins to fix

                      Cognitive Complexity

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

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

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

                      Further reading

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

                        def __init__(self,
                      Severity: Minor
                      Found in official/nlp/modeling/layers/tn_expand_condense.py - About 45 mins to fix

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

                        def _cache_memory(current_state, previous_state, memory_length, reuse_length=0):
                          """Caches hidden states into memory.
                        
                          Args:
                            current_state: `Tensor`, the current state.
                        Severity: Minor
                        Found in official/nlp/modeling/layers/transformer_xl.py - About 45 mins to fix

                        Cognitive Complexity

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

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

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

                        Further reading

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

                          def __init__(self,
                                       num_attention_heads,
                                       intermediate_size,
                                       intermediate_activation,
                                       dropout_rate=0.0,
                        Severity: Minor
                        Found in official/nlp/modeling/layers/transformer.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 call has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                          def call(self, query, value, key=None, attention_mask=None, cache=None,
                        Severity: Minor
                        Found in official/nlp/modeling/layers/kernel_attention.py - About 45 mins to fix

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

                          def bigbird_block_rand_mask(from_seq_length,
                          Severity: Minor
                          Found in official/nlp/modeling/layers/bigbird_attention.py - About 45 mins to fix

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

                            def _generalized_kernel(x, y, is_query, projection_matrix, f, h):
                            Severity: Minor
                            Found in official/nlp/modeling/layers/kernel_attention.py - About 45 mins to fix

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

                                def bert_pack_inputs(inputs: Union[tf.RaggedTensor, List[tf.RaggedTensor]],
                                                     seq_length: Union[int, tf.Tensor],
                                                     start_of_sequence_id: Union[int, tf.Tensor],
                                                     end_of_segment_id: Union[int, tf.Tensor],
                                                     padding_id: Union[int, tf.Tensor],
                              Severity: Minor
                              Found in official/nlp/modeling/layers/text_layers.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

                                        for j in range(random_start, len(random_document)):
                                          tokens_b.extend(random_document[j])
                                          if len(tokens_b) >= target_b_length:
                                            break
                                        # We didn't actually use these segments so we "put them back" so
                              Severity: Major
                              Found in official/nlp/data/create_pretraining_data.py - About 45 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language