tensorflow/models

View on GitHub

Showing 5,078 of 11,634 total issues

Function _obtain_input_shape has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
Open

def _obtain_input_shape(
    input_shape,
    default_size,
    min_size,
    data_format,

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

File seq2seq_transformer.py has 542 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2024 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 official/nlp/modeling/models/seq2seq_transformer.py - About 1 day to fix

    File panoptic_quality.py has 536 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # Copyright 2024 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 official/vision/evaluation/panoptic_quality.py - About 1 day to fix

      File bert_encoder.py has 534 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # Copyright 2024 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 official/nlp/modeling/networks/bert_encoder.py - About 1 day to fix

        File vgg_test.py has 532 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # Copyright 2016 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 research/slim/nets/vgg_test.py - About 1 day to fix

          Function visualize_boxes_and_labels_on_image_array has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
          Open

          def visualize_boxes_and_labels_on_image_array(
              image,
              boxes,
              classes,
              scores,
          Severity: Minor
          Found in research/cognitive_planning/visualization_utils.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 create_instances_from_document has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
          Open

          def create_instances_from_document(
              all_documents, document_index, max_seq_length, short_seq_prob,
              masked_lm_prob, max_predictions_per_seq, vocab_words, rng,
              do_whole_word_mask=False,
              max_ngram_size=None):
          Severity: Minor
          Found in official/nlp/data/create_pretraining_data.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 train has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
          Open

            def train(
                self,
                train_input_fn: Callable[[params_dict.ParamsDict], tf.data.Dataset],
                eval_input_fn: Optional[Callable[[params_dict.ParamsDict],
                                                 tf.data.Dataset]] = None,
          Severity: Minor
          Found in official/legacy/detection/executor/distributed_executor.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 visualize_boxes_and_labels_on_image_array has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
          Open

          def visualize_boxes_and_labels_on_image_array(
              image,
              boxes,
              classes,
              scores,
          Severity: Minor
          Found in official/vision/utils/object_detection/visualization_utils.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

          File autoaugment.py has 530 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # Copyright 2024 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 official/projects/unified_detector/data_loaders/autoaugment.py - About 1 day to fix

            File resnet_v1_test.py has 528 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # Copyright 2016 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 research/slim/nets/resnet_v1_test.py - About 1 day to fix

              File yolo_decoder.py has 528 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # Copyright 2024 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 official/projects/yolo/modeling/decoders/yolo_decoder.py - About 1 day to fix

                File maskrcnn.py has 525 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # Copyright 2024 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 official/vision/tasks/maskrcnn.py - About 1 day to fix

                  File resnet_unet.py has 522 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # Copyright 2024 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 official/vision/modeling/backbones/resnet_unet.py - About 1 day to fix

                    File graphs.py has 521 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    # Copyright 2017 Google Inc. 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 research/adversarial_text/graphs.py - About 1 day to fix

                      File label_map_util_test.py has 519 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      # Copyright 2017 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 research/object_detection/utils/label_map_util_test.py - About 1 day to fix

                        Function write_predictions has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def write_predictions(all_examples, all_features, all_results, n_best_size,
                                              max_answer_length, output_prediction_file,
                                              output_nbest_file, output_null_log_odds_file, orig_data,
                                              start_n_top, end_n_top):
                          """Writes final predictions to the json file and log-odds of null if needed."""
                        Severity: Minor
                        Found in official/legacy/xlnet/squad_utils.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 train has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def train(self):
                            """Trains the model."""
                            params = self.params
                            flags_obj = self.flags_obj
                            # Sets config options.
                        Severity: Minor
                        Found in official/legacy/transformer/transformer_main.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

                        File dataset_loader.py has 517 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        # Copyright 2017 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 research/vid2depth/dataset/dataset_loader.py - About 1 day to fix

                          File losses.py has 513 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          # Copyright 2024 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 official/legacy/detection/modeling/losses.py - About 1 day to fix
                            Severity
                            Category
                            Status
                            Source
                            Language