tensorflow/models

View on GitHub

Showing 5,078 of 11,634 total issues

Function sample_expert_path has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
Open

def sample_expert_path(env_str, env_spec):
  """Algorithmic tasks have known distribution of expert paths we sample from."""
  t = random.randint(2, 10)  # sequence length
  observations = []
  actions = [env_spec.initial_act(None)]
Severity: Minor
Found in research/pcl_rl/expert_paths.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 lstm_cells.py has 578 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2018 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/lstm_object_detection/lstm/lstm_cells.py - About 1 day to fix

    File dataset_builder_test.py has 575 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/builders/dataset_builder_test.py - About 1 day to fix

      File create_xlnet_pretraining_data.py has 573 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/data/create_xlnet_pretraining_data.py - About 1 day to fix

        Function batch_multiclass_non_max_suppression has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
        Open

        def batch_multiclass_non_max_suppression(boxes,
                                                 scores,
                                                 score_thresh,
                                                 iou_thresh,
                                                 max_size_per_class,
        Severity: Minor
        Found in research/object_detection/core/post_processing.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 train.py has 570 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # Copyright 2018 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/efficient-hrl/train.py - About 1 day to fix

          File image_classification.py has 570 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/configs/image_classification.py - About 1 day to fix

            File augment_test.py has 566 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/ops/augment_test.py - About 1 day to fix

              File yolo_loss.py has 566 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/losses/yolo_loss.py - About 1 day to fix

                File beam_search.py has 562 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/ops/beam_search.py - About 1 day to fix

                  File data_utils.py has 562 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/xlnet/data_utils.py - About 1 day to fix

                    File exporter.py has 561 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/exporter.py - About 1 day to fix

                      File context_rcnn_meta_arch.py has 560 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      # Copyright 2020 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

                        Function call has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def call(self, inputs):
                            """Implements call() for the layer."""
                            inp_k = inputs["inp_k"]
                            seg_id = inputs["seg_id"]
                            input_mask = inputs["input_mask"]
                        Severity: Minor
                        Found in official/legacy/xlnet/xlnet_modeling.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 convert_groundtruths_to_coco_dataset has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def convert_groundtruths_to_coco_dataset(groundtruths, label_map=None):
                          """Converts ground-truths to the dataset in COCO format.
                        
                          Args:
                            groundtruths: a dictionary of numpy arrays including the fields below.
                        Severity: Minor
                        Found in official/vision/evaluation/coco_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 tf_example_builder_test.py has 557 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/data/tf_example_builder_test.py - About 1 day to fix

                          File moe.py has 554 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/layers/moe.py - About 1 day to fix

                            File losses_builder_test.py has 552 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/builders/losses_builder_test.py - About 1 day to fix

                              File box_utils.py has 552 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/utils/box_utils.py - About 1 day to fix

                                File run_lfads.py has 547 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/lfads/run_lfads.py - About 1 day to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language