tensorflow/models

View on GitHub

Showing 11,634 of 11,634 total issues

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

def pretrain_model(bert_config,
Severity: Minor
Found in official/legacy/bert/bert_models.py - About 45 mins to fix

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

    def prediction_output_squad(strategy, input_meta_data, tokenizer, squad_lib,
    Severity: Minor
    Found in official/legacy/bert/run_squad_helper.py - About 45 mins to fix

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

      def dump_to_files(all_predictions,
      Severity: Minor
      Found in official/legacy/bert/run_squad_helper.py - About 45 mins to fix

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

          def testAnchorRpnSample(self, num_anchors, num_positives,
        Severity: Minor
        Found in official/vision/ops/anchor_test.py - About 45 mins to fix

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

            def _gather_batched(self, labels, match_indices, mask, mask_val):
              """Gather based on batched labels."""
              batch_size = labels.shape[0]
              if batch_size == 1:
                if mask is not None:
          Severity: Minor
          Found in official/vision/ops/target_gather.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 train_squad has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def train_squad(strategy,
          Severity: Minor
          Found in official/legacy/bert/run_squad.py - About 45 mins to fix

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

            def main(_):
              gin.parse_config_files_and_bindings(FLAGS.gin_file, FLAGS.gin_param)
            
              with tf.io.gfile.GFile(FLAGS.input_meta_data_path, 'rb') as reader:
                input_meta_data = json.loads(reader.read().decode('utf-8'))
            Severity: Minor
            Found in official/legacy/bert/run_squad.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(params: base_configs.ExperimentConfig,
                           dataset_builder: dataset_factory.DatasetBuilder):
              """Initializes backend related initializations."""
              keras_utils.set_session_config(enable_xla=params.runtime.enable_xla)
              performance.set_mixed_precision_policy(dataset_builder.dtype)
            Severity: Minor
            Found in official/legacy/image_classification/classifier_trainer.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 predict_squad has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def predict_squad(strategy,
            Severity: Minor
            Found in official/legacy/bert/run_squad_helper.py - About 45 mins to fix

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

              def instance_masks_overlap(
              Severity: Minor
              Found in official/vision/ops/mask_ops.py - About 45 mins to fix

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

                def apply_transform_to_images(
                    images,
                    transforms,
                    fill_mode='reflect',
                    fill_value=0.0,
                Severity: Minor
                Found in official/legacy/image_classification/augment.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 preprocess_for_eval has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def preprocess_for_eval(
                Severity: Minor
                Found in official/legacy/image_classification/preprocessing.py - About 45 mins to fix

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

                  def get_callbacks(
                      model_checkpoint: bool = True,
                      include_tensorboard: bool = True,
                      time_history: bool = True,
                      track_lr: bool = True,
                  Severity: Minor
                  Found in official/legacy/image_classification/callbacks.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__(
                  Severity: Minor
                  Found in official/vision/ops/anchor.py - About 45 mins to fix

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

                      def distort(self, image: tf.Tensor) -> tf.Tensor:
                        """Applies the AutoAugment policy to `image`.
                    
                        AutoAugment is from the paper: https://arxiv.org/abs/1805.09501.
                    
                    
                    Severity: Minor
                    Found in official/legacy/image_classification/augment.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

                              if eval_input_fn:
                                # Re-initialize evaluation metric.
                                eval_loss_metric.reset_states()
                                for metric in eval_metrics + model.metrics:
                                  metric.reset_states()
                    Severity: Major
                    Found in official/legacy/bert/model_training_utils.py - About 45 mins to fix

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

                        def testEquivalentResult(self, min_level, max_level, aspect_ratios,
                      Severity: Minor
                      Found in official/vision/ops/anchor_test.py - About 45 mins to fix

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

                        def normalize_images(features: tf.Tensor,
                        Severity: Minor
                        Found in official/legacy/image_classification/preprocessing.py - About 45 mins to fix

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

                          def gather_instances(selected_indices, instances, *aux_instances):
                            """Gathers instances by indices.
                          
                            Args:
                              selected_indices: a Tensor of shape [batch, K] which indicates the selected
                          Severity: Minor
                          Found in official/vision/ops/box_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 crop_mask_in_target_box has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          def crop_mask_in_target_box(masks: tf.Tensor,
                          Severity: Minor
                          Found in official/vision/ops/spatial_transform_ops.py - About 45 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language