tensorflow/models

View on GitHub

Showing 11,634 of 11,634 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        predictions_ = {
            'category_mask': predictions['category_mask'][idx],
            'instance_mask': predictions['instance_mask'][idx]
Severity: Minor
Found in official/vision/evaluation/panoptic_quality_evaluator.py and 1 other location - About 45 mins to fix
official/vision/evaluation/panoptic_quality_evaluator.py on lines 185..187

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  index_list = [str(im_array[0]) for im_array in np.squeeze(cfg['imlist'])]
Severity: Minor
Found in research/delf/delf/python/datasets/revisited_op/dataset.py and 1 other location - About 45 mins to fix
research/delf/delf/python/datasets/revisited_op/dataset.py on lines 52..52

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  if additional_fields is None:
    ordered_additional_fields = collections.OrderedDict()
  else:
    ordered_additional_fields = collections.OrderedDict(
        sorted(additional_fields.items(), key=lambda item: item[0]))
Severity: Minor
Found in research/object_detection/core/post_processing.py and 1 other location - About 45 mins to fix
research/efficient-hrl/agents/circular_buffer.py on lines 123..125

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      for (class_id, is_matched) in zip(remained_pred_classes, pred_matched):
        if not is_matched:
          sum_num_fp[class_id] += 1
Severity: Minor
Found in research/object_detection/metrics/coco_evaluation.py and 1 other location - About 45 mins to fix
research/object_detection/metrics/coco_evaluation.py on lines 1640..1642

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  if not len(image_ids) == len(groundtruth_boxes) == len(groundtruth_classes):
    raise ValueError('Input lists must have the same length')
Severity: Minor
Found in research/object_detection/metrics/coco_tools.py and 1 other location - About 45 mins to fix
research/object_detection/core/losses.py on lines 691..692

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        x = scale / 2 - scale * (res - j) / res
Severity: Minor
Found in research/vid2depth/ops/icp_test.py and 1 other location - About 45 mins to fix
research/vid2depth/ops/icp_test.py on lines 78..78

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def create_train_input_fn(train_config, train_input_config,
                          model_config):
  """Creates a train `input` function for `Estimator`.

  Args:
Severity: Minor
Found in research/object_detection/inputs.py and 1 other location - About 45 mins to fix
research/object_detection/inputs.py on lines 917..933

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    s += "tokens: %s\n" % (" ".join(
        [tokenization.printable_text(x) for x in self.tokens]))
Severity: Minor
Found in official/nlp/data/create_pretraining_data.py and 1 other location - About 45 mins to fix
official/nlp/data/create_pretraining_data.py on lines 123..124

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      output_tokens, masked_positions, masked_labels = (
          cpd.create_masked_lm_predictions(
Severity: Minor
Found in official/nlp/data/create_pretraining_data_test.py and 1 other location - About 45 mins to fix
official/nlp/data/create_pretraining_data_test.py on lines 92..93

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  def _make_config_dict(self):
    return {
        'network': self._network,
        'num_classes': self.num_classes,
        'head_name': self.head_name,
Severity: Minor
Found in official/nlp/modeling/models/bert_classifier.py and 1 other location - About 45 mins to fix
official/legacy/image_classification/resnet/common.py on lines 98..105

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      weights = tf.constant([[[1], [1], [1], [1], [1], [1]]], tf.float32)
Severity: Minor
Found in research/object_detection/core/losses_test.py and 1 other location - About 45 mins to fix
research/object_detection/core/losses_test.py on lines 420..425

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    node_pre_up = slim.conv2d(
        net,
        num_filters, [1, 1],
        activation_fn=tf.identity,
        normalizer_fn=self._normalization_fn,
research/object_detection/models/ssd_spaghettinet_feature_extractor.py on lines 283..289

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    vis_utils.visualize_boxes_and_labels_on_image_array(
Severity: Minor
Found in research/object_detection/eval_util.py and 1 other location - About 45 mins to fix
official/recommendation/ncf_common.py on lines 150..150

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 35.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Consider simplifying this complex logical expression.
Open

  if 'resnet' in model_variant:
    arg_scope = arg_scopes_map[model_variant](
        weight_decay=weight_decay,
        batch_norm_decay=0.95,
        batch_norm_epsilon=1e-5,
Severity: Major
Found in research/deeplab/core/feature_extractor.py - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

          if (random.random() < 0.1 and summary and episode_rewards and
              is_chief and sv and sv._summary_writer):
            sv.summary_computed(sess, summary)
    
    
    Severity: Major
    Found in research/pcl_rl/trainer.py - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

              if kl_weight >= 1.0 and \
                (l2_weight >= 1.0 or \
                 (self.hps.l2_gen_scale == 0.0 and self.hps.l2_con_scale == 0.0)) \
                 and (len(valid_costs) > n_lve and run_avg_lve < lowest_ev_cost):
      
      
      Severity: Major
      Found in research/lfads/lfads.py - About 40 mins to fix

        Similar blocks of code found in 14 locations. Consider refactoring.
        Open

            self.assertAllClose(
                [0.5],
                seq_feature_dict['region/bbox/ymax'].feature[1].float_list.value[:])
        research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 193..195
        research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 196..198
        research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 199..201
        research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 202..204
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 411..413
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 415..417
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 419..421
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 423..425
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 427..429
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 431..433
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 440..442
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 443..445
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 449..451

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 34.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 14 locations. Consider refactoring.
        Open

            self.assertAllClose(
                [0.],
                seq_feature_dict[
        research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 193..195
        research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 196..198
        research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 199..201
        research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 202..204
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 415..417
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 419..421
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 423..425
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 427..429
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 431..433
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 440..442
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 443..445
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 446..448
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 449..451

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 34.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 14 locations. Consider refactoring.
        Open

            self.assertAllClose(
                [0.0],
                seq_feature_dict['region/bbox/xmin'].feature[1].float_list.value[:])
        research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 193..195
        research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 199..201
        research/object_detection/dataset_tools/context_rcnn/add_context_to_examples_tf2_test.py on lines 202..204
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 411..413
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 415..417
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 419..421
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 423..425
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 427..429
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 431..433
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 440..442
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 443..445
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 446..448
        research/object_detection/dataset_tools/seq_example_util_test.py on lines 449..451

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 34.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 12 locations. Consider refactoring.
        Open

            inputs = tf.convert_to_tensor(
                np.array([[2, 2, 1, 3, 1, 0], [3, 3, 1, 2, 2, 1]]))
        Severity: Major
        Found in official/nlp/modeling/models/t5_test.py and 11 other locations - About 40 mins to fix
        official/nlp/modeling/models/t5_test.py on lines 480..481
        official/nlp/modeling/models/t5_test.py on lines 482..483
        official/nlp/modeling/models/t5_test.py on lines 525..526
        official/nlp/modeling/models/t5_test.py on lines 528..529
        official/nlp/modeling/models/t5_test.py on lines 583..584
        official/nlp/modeling/models/t5_test.py on lines 585..586
        official/nlp/modeling/models/t5_test.py on lines 648..649
        official/nlp/modeling/models/t5_test.py on lines 705..706
        official/nlp/modeling/models/t5_test.py on lines 707..708
        official/nlp/modeling/models/t5_test.py on lines 756..757
        official/nlp/modeling/models/t5_test.py on lines 758..759

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 34.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Severity
        Category
        Status
        Source
        Language