tensorflow/models

View on GitHub

Showing 11,634 of 11,634 total issues

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

def variables_to_restore(scope=None, strip_scope=False):
  """Returns a list of variables to restore for the specified list of methods.

  It is supposed that variable name starts with the method's scope (a prefix
  returned by _method_scope function).
Severity: Minor
Found in research/attention_ocr/python/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 gen_api_docs has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def gen_api_docs(code_url_prefix, site_path, output_dir, project_short_name,
Severity: Minor
Found in official/utils/docs/build_tfm_api_docs.py - About 45 mins to fix

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

    def _run_experiment_with_preemption_recovery(params, model_dir):
      """Runs experiment and tries to reconnect when encounting a preemption."""
      keep_training = True
      while keep_training:
        preemption_watcher = None
    Severity: Minor
    Found in official/nlp/train.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_image has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def preprocess_image(image,
    Severity: Minor
    Found in research/attention_ocr/python/inception_preprocessing.py - About 45 mins to fix

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

      def convert(checkpoint_from_path,
      Severity: Minor
      Found in official/nlp/tools/tf1_bert_checkpoint_converter_lib.py - About 45 mins to fix

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

        def create_input_fn(runner_config, mode, drop_remainder):
          """Returns an input function to use in the instantiation of tf.estimator.*."""
        
          def _post_processor(features, batch_size):
            """Post process the data to a form expected by model_fn."""
        Severity: Minor
        Found in research/seq_flow_lite/input_fn_reader.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 gen_api_docs has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def gen_api_docs(code_url_prefix, site_path, output_dir, project_short_name,
        Severity: Minor
        Found in official/utils/docs/build_orbit_api_docs.py - About 45 mins to fix

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

          def generate_synthetic_data(input_shape,
          Severity: Minor
          Found in official/utils/misc/model_helpers.py - About 45 mins to fix

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

            def export_model(export_path: Text,
                             *,
                             bert_config: Optional[configs.BertConfig] = None,
                             encoder_config: Optional[encoders.EncoderConfig] = None,
                             model_checkpoint_path: Text,
            Severity: Minor
            Found in official/nlp/tools/export_tfhub_lib.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 write_tagging has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def write_tagging(task, model, input_file, output_file, predict_batch_size,
            Severity: Minor
            Found in official/nlp/finetuning/binary_helper.py - About 45 mins to fix

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

              def create_preprocessing(*,
              Severity: Minor
              Found in official/nlp/tools/export_tfhub_lib.py - About 45 mins to fix

                Function __init__ has a Cognitive Complexity of 8 (exceeds 5 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 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 create_summaries has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  def create_summaries(self, data, endpoints, charset, is_training):
                    """Creates all summaries for the model.
                
                    Args:
                      data: InputEndpoints namedtuple.
                Severity: Minor
                Found in research/attention_ocr/python/model.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_nondefault_flags_as_str has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                def get_nondefault_flags_as_str():
                  """Returns flags as a string that can be passed as command line arguments.
                
                  E.g., returns: "--batch_size=256 --use_synthetic_data" for the following code
                  block:
                Severity: Minor
                Found in official/utils/flags/core.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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                  def call(self, inputs, mask, inverse_normalizer, attn_mask=None):
                    batch_size = self.get_batch_dimension(inputs)
                    self._assert_rank_and_type(inputs, 3)
                    self._assert_rank_and_type(mask, 3)
                    assert inputs.get_shape().as_list()[-1] == self.model_dimension
                Severity: Minor
                Found in research/seq_flow_lite/layers/transformer_layers.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_train has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def preprocess_for_train(image,
                Severity: Minor
                Found in research/attention_ocr/python/inception_preprocessing.py - About 45 mins to fix

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

                    def __call__(self,
                                 query,
                                 mask=None,
                                 kv=None,
                                 position_bias=None,
                  Severity: Minor
                  Found in official/nlp/modeling/models/t5.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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def call(self,
                             target,
                             memory,
                             self_attention_mask=None,
                             cross_attention_mask=None,
                  Severity: Minor
                  Found in official/nlp/modeling/models/seq2seq_transformer.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 testSentenceOrderPrediction has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    def testSentenceOrderPrediction(self,
                  Severity: Minor
                  Found in official/nlp/modeling/ops/segment_extractor_test.py - About 45 mins to fix

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

                      def __call__(self,
                    Severity: Minor
                    Found in official/nlp/modeling/models/t5.py - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language