tensorflow/models

View on GitHub

Showing 11,634 of 11,634 total issues

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

  def initialize(self, model: tf_keras.Model):
    """Loading pretrained checkpoint."""

    if not self.task_config.init_checkpoint:
      logging.info('Training from Scratch.')
Severity: Minor
Found in official/projects/yolo/tasks/yolo.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 get_export_module has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def get_export_module(params: cfg.ExperimentConfig,
Severity: Minor
Found in official/projects/yolo/serving/export_module_factory.py - About 45 mins to fix

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

      def post_path_aggregation(self, loss, box_loss, conf_loss, class_loss,
    Severity: Minor
    Found in official/projects/yolo/losses/yolo_loss.py - About 45 mins to fix

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

        def call(self, inputs, training):  # pytype: disable=signature-mismatch  # overriding-parameter-count-checks
          # call backbone network.
          all_feats = self.backbone(inputs, training=training)
          if self.use_original_backbone_features:
            feats = all_feats[self.min_level:self.max_level + 1]
      Severity: Minor
      Found in official/projects/edgetpu/vision/tasks/semantic_segmentation.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 argmax has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def argmax(input_tensor,
      Severity: Minor
      Found in official/projects/edgetpu/vision/modeling/custom_layers.py - About 45 mins to fix

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

          def from_search_config(cls,

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

          def create_classification_export_module(
          Severity: Minor
          Found in official/projects/yolo/serving/export_module_factory.py - About 45 mins to fix

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

              def post_path_aggregation(self, loss, box_loss, conf_loss, class_loss,
            Severity: Minor
            Found in official/projects/yolo/losses/yolo_loss.py - About 45 mins to fix

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

              def build_yolo_decoder(
                  input_specs: Mapping[str, tf.TensorShape],
                  model_config: hyperparams.Config,
                  l2_regularizer: Optional[tf_keras.regularizers.Regularizer] = None,
                  **kwargs) -> Union[None, tf_keras.Model, tf_keras.layers.Layer]:
              Severity: Minor
              Found in official/projects/yolo/modeling/decoders/yolo_decoder.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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def initialize(self, model: tf_keras.Model):
                  """Loading pretrained checkpoint."""
              
                  if not self.task_config.init_checkpoint:
                    logging.info('Training from Scratch.')
              Severity: Minor
              Found in official/projects/yolo/tasks/yolov7.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 _get_variable_group has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def _get_variable_group(self, var, coefficients):
                  if self._variables_set:
                    # check which groups hold which varaibles, preset.
                    if _var_key(var) in self._wset:
                      return True, False, False
              Severity: Minor
              Found in official/projects/yolo/optimization/sgd_torch.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 build has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                def build(self, input_shape):
                  dark_conv_args = {
                      'activation': self._activation,
                      'kernel_initializer': self._kernel_initializer,
                      'bias_initializer': self._bias_initializer,
              Severity: Minor
              Found in official/projects/yolo/modeling/layers/nn_blocks.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 normalize_images has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def normalize_images(
              Severity: Minor
              Found in official/projects/edgetpu/vision/modeling/common_modules.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/projects/edgetpu/nlp/mobilebert_edgetpu_trainer.py - About 45 mins to fix

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

                    def _compute_loss(self, true_counts, inds, y_true, boxes, classes, y_pred):
                  Severity: Minor
                  Found in official/projects/yolo/losses/yolo_loss.py - About 45 mins to fix

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

                    def create_yolo_export_module(
                    Severity: Minor
                    Found in official/projects/yolo/serving/export_module_factory.py - About 45 mins to fix

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

                      def run_export():
                        """Exports TFLite with PTQ."""
                        export_config = get_export_config_from_flags()
                        model = export_util.build_experiment_model(
                            experiment_type=export_config.model_name)
                      Severity: Minor
                      Found in official/projects/edgetpu/vision/serving/export_tflite.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, x, enc, caches, mask_self, mask_cross, training):
                      Severity: Minor
                      Found in official/projects/pix2seq/modeling/transformer.py - About 45 mins to fix

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

                        def merge_boxes_with_multiple_labels(boxes: tf.Tensor,
                                                             classes: tf.Tensor,
                                                             confidences: tf.Tensor,
                                                             num_classes: int,
                                                             quantization_bins: int = 10000):
                        Severity: Minor
                        Found in official/projects/videoglue/datasets/common/utils.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 add_seq_pos_emb has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def add_seq_pos_emb(
                        Severity: Minor
                        Found in official/projects/pix2seq/modeling/pix2seq_model.py - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language