tensorflow/models

View on GitHub

Showing 11,634 of 11,634 total issues

Function main has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def main(argv):
  if len(argv) > 1:
    raise RuntimeError('Too many command-line arguments.')

  # Manually check if there are unknown test datasets and if the dataset
Severity: Minor
Found in research/delf/delf/python/training/global_features/train.py - About 1 hr to fix

    Function crop_and_threshold_masks has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def crop_and_threshold_masks(elems, input_height, input_width, mask_height=256,
                                 mask_width=256, score_threshold=0.5,
                                 densepose_class_index=-1):
      """Crops and thresholds masks based on detection boxes.
    
    

      Function test_get_configs_from_multiple_files has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def test_get_configs_from_multiple_files(self):
          """Tests that proto configs can be read from multiple files."""
          temp_dir = self.get_temp_dir()
      
          # Write model config file.
      Severity: Minor
      Found in research/object_detection/utils/config_util_test.py - About 1 hr to fix

        Function testCheckAndParseInputConfigKey has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def testCheckAndParseInputConfigKey(self):
            pipeline_config_path = os.path.join(self.get_temp_dir(), "pipeline.config")
            pipeline_config = pipeline_pb2.TrainEvalPipelineConfig()
            pipeline_config.eval_input_reader.add().name = "eval_1"
            pipeline_config.eval_input_reader.add().name = "eval_2"
        Severity: Minor
        Found in research/object_detection/utils/config_util_test.py - About 1 hr to fix

          Function test_vrdrelation_evaluator has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def test_vrdrelation_evaluator(self):
              self.vrd_eval = vrd_evaluation.VRDRelationDetectionEvaluator()
          
              image_key1 = 'img1'
              groundtruth_box_tuples1 = np.array(
          Severity: Minor
          Found in research/object_detection/utils/vrd_evaluation_test.py - About 1 hr to fix

            Function test_vrdphrase_evaluator has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def test_vrdphrase_evaluator(self):
                self.vrd_eval = vrd_evaluation.VRDPhraseDetectionEvaluator()
            
                image_key1 = 'img1'
                groundtruth_box_tuples1 = np.array(
            Severity: Minor
            Found in research/object_detection/utils/vrd_evaluation_test.py - About 1 hr to fix

              Function eval_model_runs_avg_epoch has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def eval_model_runs_avg_epoch(self, data_name, data_extxd,
                                              ext_input_extxi=None):
                  """Returns all the expected value for goodies for the entire model.
              
                  The expected value is taken over hidden (z) variables, namely the initial
              Severity: Minor
              Found in research/lfads/lfads.py - About 1 hr to fix

                Function eval_model_runs_push_mean has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def eval_model_runs_push_mean(self, data_name, data_extxd,
                                                ext_input_extxi=None):
                    """Returns values of interest for the model by pushing the means through
                
                    The mean values for both initial conditions and the control inputs are
                Severity: Minor
                Found in research/lfads/lfads.py - About 1 hr to fix

                  Function __init__ has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def __init__(self, config, mode, **kwargs):
                      super(Encoder, self).__init__(**kwargs)
                  
                      def _get_params(varname, default_value=None):
                        value = config[varname] if varname in config else default_value
                  Severity: Minor
                  Found in research/seq_flow_lite/models/charformer.py - About 1 hr to fix

                    Function test_network_invocation has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def test_network_invocation(self):
                        hidden_size = 32
                        sequence_length = 21
                        vocab_size = 57
                        num_types = 7
                    Severity: Minor
                    Found in official/nlp/modeling/networks/albert_encoder_test.py - About 1 hr to fix

                      Function __init__ has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def __init__(self,
                                     vocab_size,
                                     num_layers,
                                     hidden_size,
                                     num_attention_heads,
                      Severity: Minor
                      Found in official/nlp/modeling/networks/xlnet_base.py - About 1 hr to fix

                        Function test_network_creation has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def test_network_creation(self, use_position_id, pack_multiple_sequences,
                                                    use_float16):
                            """Validate that the Keras object can be created."""
                            if use_float16:
                              tf_keras.mixed_precision.set_global_policy('mixed_float16')
                        Severity: Minor
                        Found in official/nlp/modeling/networks/packed_sequence_embedding_test.py - About 1 hr to fix

                          Function test_network_invocation has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def test_network_invocation(self, output_range, out_seq_len):
                              hidden_size = 32
                              sequence_length = 21
                              vocab_size = 57
                              num_types = 7
                          Severity: Minor
                          Found in official/nlp/modeling/networks/bert_encoder_test.py - About 1 hr to fix

                            Function _word_span_mask has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def _word_span_mask(self, inputs: tf.Tensor, boundary: tf.Tensor):
                                """Sample whole word spans as prediction targets."""
                                min_num_words = self._params.min_num_words
                                max_num_words = self._params.max_num_words
                            
                            
                            Severity: Minor
                            Found in official/nlp/data/pretrain_dataloader.py - About 1 hr to fix

                              Function convert_single_example has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              def convert_single_example(ex_index, example, label_list, max_seq_length,
                                                         tokenizer):
                                """Converts a single `InputExample` into a single `InputFeatures`."""
                                label_map = {}
                                if label_list:
                              Severity: Minor
                              Found in official/nlp/data/classifier_data_lib.py - About 1 hr to fix

                                Function __init__ has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  def __init__(self,
                                               output_size,
                                               min_level,
                                               max_level,
                                               num_scales,
                                Severity: Minor
                                Found in official/legacy/detection/dataloader/shapemask_parser.py - About 1 hr to fix

                                  Function define_transformer_flags has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  def define_transformer_flags():
                                    """Add flags and flag validators for running transformer_main."""
                                    # Add common flags (data_dir, model_dir, etc.).
                                    flags_core.define_base(num_gpu=True, distribution_strategy=True)
                                    flags_core.define_performance(
                                  Severity: Minor
                                  Found in official/legacy/transformer/misc.py - About 1 hr to fix

                                    Function __init__ has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      def __init__(self, flags_obj):
                                        """Init function of TransformerMain.
                                    
                                        Args:
                                          flags_obj: Object containing parsed flag values, i.e., FLAGS.
                                    Severity: Minor
                                    Found in official/legacy/transformer/transformer_main.py - About 1 hr to fix

                                      Function _compute_grid_positions has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      def _compute_grid_positions(
                                          boxes: tf.Tensor, boundaries: tf.Tensor, output_size: int,
                                          sample_offset: float) -> Tuple[tf.Tensor, tf.Tensor, tf.Tensor, tf.Tensor]:
                                        """Computes the grid position w.r.t.
                                      
                                      
                                      Severity: Minor
                                      Found in official/vision/ops/spatial_transform_ops.py - About 1 hr to fix

                                        Function __init__ has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                          def __init__(
                                              self,
                                              model_id: str = 'MobileNetV2',
                                              filter_size_scale: float = 1.0,
                                              input_specs: tf_keras.layers.InputSpec = layers.InputSpec(
                                        Severity: Minor
                                        Found in official/vision/modeling/backbones/mobilenet.py - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language