tensorflow/models

View on GitHub

Showing 11,634 of 11,634 total issues

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

  def __init__(self,
               vocab_size,
               embedding_width=128,
               hidden_size=768,
               num_layers=12,
Severity: Minor
Found in official/nlp/modeling/networks/albert_encoder.py - About 1 hr to fix

    Function test_electra_pretrainer has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def test_electra_pretrainer(self):
        """Validate that the Keras object can be created."""
        # Build a transformer network to use within the ELECTRA trainer.
        vocab_size = 100
        sequence_length = 512
    Severity: Minor
    Found in official/nlp/modeling/models/electra_pretrainer_test.py - About 1 hr to fix

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

        def __init__(
            self,
            vocab_size: int,
            hidden_size: int = 768,
            num_layers: int = 12,
      Severity: Minor
      Found in official/nlp/modeling/networks/funnel_transformer.py - About 1 hr to fix

        Function test_network_invocation_with_external_logit_output has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def test_network_invocation_with_external_logit_output(self):
            """Validate that the logit outputs are correct."""
            sequence_length = 15
            input_width = 512
            test_network = span_labeling.SpanLabeling(
        Severity: Minor
        Found in official/nlp/modeling/networks/span_labeling_test.py - About 1 hr to fix

          Function test_layer_with_feedforward_cls_restoration_from_config has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def test_layer_with_feedforward_cls_restoration_from_config(self):
              sequence_length = 21
              width = 80
          
              call_list = []
          Severity: Minor
          Found in official/nlp/modeling/layers/transformer_scaffold_test.py - About 1 hr to fix

            Function _token_span_mask has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def _token_span_mask(self, inputs: tf.Tensor) -> tf.Tensor:
                """Samples token spans as prediction targets."""
                min_num_tokens = self._params.min_num_tokens
                max_num_tokens = self._params.max_num_tokens
            
            
            Severity: Minor
            Found in official/nlp/data/pretrain_dataloader.py - About 1 hr to fix

              Function _parse_train_data has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def _parse_train_data(self, data):
                  """Parses data for training.
              
                  Args:
                    data: the decoded tensor dictionary from TfExampleDecoder.
              Severity: Minor
              Found in official/legacy/detection/dataloader/maskrcnn_parser.py - About 1 hr to fix

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

                  def __init__(self, params):
                    super(OlnMaskModel, self).__init__(params)
                
                    self._params = params
                
                
                Severity: Minor
                Found in official/legacy/detection/modeling/olnmask_model.py - About 1 hr to fix

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

                  def main(unused_argv):
                    del unused_argv
                    strategy = distribute_utils.get_distribution_strategy(
                        distribution_strategy=FLAGS.strategy_type,
                        tpu_address=FLAGS.tpu)
                  Severity: Minor
                  Found in official/legacy/xlnet/run_squad.py - About 1 hr to fix

                    Function label_anchors has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def label_anchors(
                          self,
                          anchor_boxes: Dict[str, tf.Tensor],
                          gt_boxes: tf.Tensor,
                          gt_labels: tf.Tensor,
                    Severity: Minor
                    Found in official/vision/ops/anchor.py - About 1 hr to fix

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

                        def __init__(self,
                                     input_params: exp_cfg.DataConfig,
                                     image_key: str = IMAGE_KEY,
                                     label_key: str = LABEL_KEY):
                          self._num_frames = input_params.feature_shape[0]
                      Severity: Minor
                      Found in official/vision/dataloaders/video_input.py - About 1 hr to fix

                        Function test_build_model has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def test_build_model(self, include_mask, use_separable_conv,
                                               build_anchor_boxes, use_outer_boxes, is_training):
                            num_classes = 3
                            min_level = 3
                            max_level = 7
                        Severity: Minor
                        Found in official/vision/modeling/maskrcnn_model_test.py - About 1 hr to fix

                          Function testDetectionsOutputShape has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def testDetectionsOutputShape(
                                self,
                                nms_version,
                                has_att_heads,
                                use_cpu_nms,
                          Severity: Minor
                          Found in official/vision/modeling/layers/detection_generator_test.py - About 1 hr to fix

                            Function test_layer_with_feedforward_cls_restoration_from_config has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def test_layer_with_feedforward_cls_restoration_from_config(self):
                                sequence_length = 21
                                width = 80
                            
                                call_list = []
                            Severity: Minor
                            Found in official/vision/modeling/layers/nn_blocks_test.py - About 1 hr to fix

                              Function _parse_train_data has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def _parse_train_data(self, data):
                                  """Parses data for training.
                              
                                  Args:
                                    data: the decoded tensor dictionary from TfExampleDecoder.
                              Severity: Minor
                              Found in official/projects/panoptic/dataloaders/panoptic_maskrcnn_input.py - About 1 hr to fix

                                Function call has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  def call(self, labels, predictions):
                                    """Comptues the OTA loss.
                                
                                    Args:
                                      labels: a dictionary contains the following required keys:
                                Severity: Minor
                                Found in official/projects/yolo/losses/yolov7_loss.py - About 1 hr to fix

                                  Function mobilenet_edgetpu has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  def mobilenet_edgetpu(image_input: tf_keras.layers.Input, config: ModelConfig):  # pytype: disable=invalid-annotation  # typed-keras
                                    """Creates a MobilenetEdgeTPU graph given the model parameters.
                                  
                                    This function is wrapped by the `MobilenetEdgeTPU` class to make a
                                    tf_keras.Model.

                                    Function test_same_output has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      def test_same_output(self):
                                        """Tests that OptimizedMultiHeadAttention returns the expected outputs."""
                                    
                                        input_tensor_1 = tf.random.uniform((_BATCH_SIZE, _SEQ_LEN, _EMBEDDING_SIZE))
                                        input_tensor_2 = tf.random.uniform((_BATCH_SIZE, _SEQ_LEN, _EMBEDDING_SIZE))

                                      Function features_map_fn has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      def features_map_fn(features, local_radius, relative_pos_max_distance,
                                                          use_hard_g2l_mask, padding_id, eos_id, null_id, cls_id,
                                                          sep_id, sequence_length, global_sequence_length):
                                        """Make features."""
                                        batch_size = tf.get_static_value(features['token_ids'].shape[0])
                                      Severity: Minor
                                      Found in official/projects/triviaqa/inputs.py - About 1 hr to fix

                                        Function test_task has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                          def test_task(self, config_name):
                                            config = exp_factory.get_exp_config(config_name)
                                            config.task.train_data.input_path = self._data_path
                                            config.task.train_data.global_batch_size = 4
                                            config.task.train_data.shuffle_buffer_size = 4
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language