tensorflow/models

View on GitHub

Showing 11,634 of 11,634 total issues

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

      weights = tf.constant([
          [[1.0, 0.0, 1.0], [0.0, 0.0, 1.0]],
          [[1.0, 1.0, 1.0], [0.0, 0.0, 0.0]],
Severity: Major
Found in research/object_detection/core/losses_test.py and 8 other locations - About 50 mins to fix
official/projects/centernet/losses/centernet_losses_test.py on lines 94..96
official/projects/waste_identification_ml/model_inference/color_and_property_extractor_test.py on lines 75..82
official/projects/waste_identification_ml/model_inference/color_and_property_extractor_test.py on lines 93..100
official/projects/yt8m/modeling/yt8m_model_utils_test.py on lines 29..31
research/deeplab/utils/get_dataset_colormap_test.py on lines 82..84
research/delf/delf/python/datum_io_test.py on lines 73..74
research/delf/delf/python/datum_io_test.py on lines 84..85
research/object_detection/meta_architectures/center_net_meta_arch_tf2_test.py on lines 1501..1503

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 36.

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

Identical blocks of code found in 3 locations. Consider refactoring.
Open

          if (len(qa["answers"]) != 1) and (not is_impossible):
            raise ValueError(
Severity: Major
Found in official/legacy/xlnet/squad_utils.py and 2 other locations - About 50 mins to fix
official/nlp/data/squad_lib.py on lines 209..210
official/nlp/data/squad_lib_sp.py on lines 142..143

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 36.

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

Identical blocks of code found in 3 locations. Consider refactoring.
Open

          if (len(qa["answers"]) != 1) and (not is_impossible):
            raise ValueError(
Severity: Major
Found in official/nlp/data/squad_lib.py and 2 other locations - About 50 mins to fix
official/legacy/xlnet/squad_utils.py on lines 453..454
official/nlp/data/squad_lib_sp.py on lines 142..143

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 36.

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 9 locations. Consider refactoring.
Open

    data = np.array([[[-1.0, 125.0, -2.5], [14.5, 3.5, 0.0]],
                     [[20.0, 0.0, 30.0], [25.5, 36.0, 42.0]]])
Severity: Major
Found in research/delf/delf/python/datum_io_test.py and 8 other locations - About 50 mins to fix
official/projects/centernet/losses/centernet_losses_test.py on lines 94..96
official/projects/waste_identification_ml/model_inference/color_and_property_extractor_test.py on lines 75..82
official/projects/waste_identification_ml/model_inference/color_and_property_extractor_test.py on lines 93..100
official/projects/yt8m/modeling/yt8m_model_utils_test.py on lines 29..31
research/deeplab/utils/get_dataset_colormap_test.py on lines 82..84
research/delf/delf/python/datum_io_test.py on lines 84..85
research/object_detection/core/losses_test.py on lines 1405..1407
research/object_detection/meta_architectures/center_net_meta_arch_tf2_test.py on lines 1501..1503

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 36.

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 9 locations. Consider refactoring.
Open

    data_1 = np.array([[[-1.0, 125.0, -2.5], [14.5, 3.5, 0.0]],
                       [[20.0, 0.0, 30.0], [25.5, 36.0, 42.0]]])
Severity: Major
Found in research/delf/delf/python/datum_io_test.py and 8 other locations - About 50 mins to fix
official/projects/centernet/losses/centernet_losses_test.py on lines 94..96
official/projects/waste_identification_ml/model_inference/color_and_property_extractor_test.py on lines 75..82
official/projects/waste_identification_ml/model_inference/color_and_property_extractor_test.py on lines 93..100
official/projects/yt8m/modeling/yt8m_model_utils_test.py on lines 29..31
research/deeplab/utils/get_dataset_colormap_test.py on lines 82..84
research/delf/delf/python/datum_io_test.py on lines 73..74
research/object_detection/core/losses_test.py on lines 1405..1407
research/object_detection/meta_architectures/center_net_meta_arch_tf2_test.py on lines 1501..1503

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 36.

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 7 locations. Consider refactoring.
Open

    if hidden_size % self._num_heads != 0:
      raise ValueError(
          "The input size (%d) is not a multiple of the number of attention "
          "heads (%d)" % (hidden_size, self._num_heads))
Severity: Major
Found in official/projects/detr/modeling/transformer.py and 6 other locations - About 50 mins to fix
official/nlp/modeling/layers/reuse_transformer.py on lines 154..157
official/nlp/modeling/layers/tn_transformer_expand_condense.py on lines 127..130
official/nlp/modeling/layers/transformer.py on lines 260..263
official/nlp/modeling/layers/transformer_scaffold.py on lines 142..145
official/nlp/modeling/layers/transformer_xl.py on lines 142..145
official/projects/detr/modeling/transformer.py on lines 670..673

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 36.

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 9 locations. Consider refactoring.
Open

      expected_refined_depths = np.array([[[-0.8, 0.0, 0.0], [0.0, 0.0, -1.0]],
                                          [[-0.7, -0.1, 0.0], [-0.7, -0.4,
                                                               0.0]]])
official/projects/centernet/losses/centernet_losses_test.py on lines 94..96
official/projects/waste_identification_ml/model_inference/color_and_property_extractor_test.py on lines 75..82
official/projects/waste_identification_ml/model_inference/color_and_property_extractor_test.py on lines 93..100
official/projects/yt8m/modeling/yt8m_model_utils_test.py on lines 29..31
research/deeplab/utils/get_dataset_colormap_test.py on lines 82..84
research/delf/delf/python/datum_io_test.py on lines 73..74
research/delf/delf/python/datum_io_test.py on lines 84..85
research/object_detection/core/losses_test.py on lines 1405..1407

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 36.

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 9 locations. Consider refactoring.
Open

    original_image = np.array([
        [
            (0, 0, 0),
            (255, 255, 255),
        ],
official/projects/centernet/losses/centernet_losses_test.py on lines 94..96
official/projects/waste_identification_ml/model_inference/color_and_property_extractor_test.py on lines 93..100
official/projects/yt8m/modeling/yt8m_model_utils_test.py on lines 29..31
research/deeplab/utils/get_dataset_colormap_test.py on lines 82..84
research/delf/delf/python/datum_io_test.py on lines 73..74
research/delf/delf/python/datum_io_test.py on lines 84..85
research/object_detection/core/losses_test.py on lines 1405..1407
research/object_detection/meta_architectures/center_net_meta_arch_tf2_test.py on lines 1501..1503

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 36.

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

Identical blocks of code found in 3 locations. Consider refactoring.
Open

          if (len(qa["answers"]) != 1) and (not is_impossible):
            raise ValueError(
Severity: Major
Found in official/nlp/data/squad_lib_sp.py and 2 other locations - About 50 mins to fix
official/legacy/xlnet/squad_utils.py on lines 453..454
official/nlp/data/squad_lib.py on lines 209..210

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 36.

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

Identical blocks of code found in 3 locations. Consider refactoring.
Open

  if masks1.dtype != np.uint8 or masks2.dtype != np.uint8:
    raise ValueError('masks1 and masks2 should be of type np.uint8')
Severity: Major
Found in research/object_detection/utils/np_mask_ops.py and 2 other locations - About 50 mins to fix
research/object_detection/utils/np_mask_ops.py on lines 65..66
research/object_detection/utils/np_mask_ops.py on lines 91..92

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 36.

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 7 locations. Consider refactoring.
Open

    if hidden_size % self.num_attention_heads != 0:
      raise ValueError(
          "The hidden size (%d) is not a multiple of the number of attention "
          "heads (%d)" % (hidden_size, self.num_attention_heads))
Severity: Major
Found in official/nlp/modeling/layers/transformer.py and 6 other locations - About 50 mins to fix
official/nlp/modeling/layers/reuse_transformer.py on lines 154..157
official/nlp/modeling/layers/tn_transformer_expand_condense.py on lines 127..130
official/nlp/modeling/layers/transformer_scaffold.py on lines 142..145
official/nlp/modeling/layers/transformer_xl.py on lines 142..145
official/projects/detr/modeling/transformer.py on lines 256..259
official/projects/detr/modeling/transformer.py on lines 670..673

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 36.

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

Identical blocks of code found in 3 locations. Consider refactoring.
Open

  if masks1.dtype != np.uint8 or masks2.dtype != np.uint8:
    raise ValueError('masks1 and masks2 should be of type np.uint8')
Severity: Major
Found in research/object_detection/utils/np_mask_ops.py and 2 other locations - About 50 mins to fix
research/object_detection/utils/np_mask_ops.py on lines 91..92
research/object_detection/utils/np_mask_ops.py on lines 120..121

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 36.

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

Identical blocks of code found in 3 locations. Consider refactoring.
Open

  if masks1.dtype != np.uint8 or masks2.dtype != np.uint8:
    raise ValueError('masks1 and masks2 should be of type np.uint8')
Severity: Major
Found in research/object_detection/utils/np_mask_ops.py and 2 other locations - About 50 mins to fix
research/object_detection/utils/np_mask_ops.py on lines 65..66
research/object_detection/utils/np_mask_ops.py on lines 120..121

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 36.

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

Identical blocks of code found in 3 locations. Consider refactoring.
Open

    output_rates = [
        self.execute(graph_fn, [np.array(step).astype(np.int64)])
Severity: Major
Found in research/object_detection/utils/learning_schedules_test.py and 2 other locations - About 50 mins to fix
research/object_detection/utils/learning_schedules_test.py on lines 107..108
research/object_detection/utils/learning_schedules_test.py on lines 128..129

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 36.

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 7 locations. Consider refactoring.
Open

    if hidden_size % self._num_heads != 0:
      raise ValueError(
          "The input size (%d) is not a multiple of the number of attention "
          "heads (%d)" % (hidden_size, self._num_heads))
Severity: Major
Found in official/nlp/modeling/layers/tn_transformer_expand_condense.py and 6 other locations - About 50 mins to fix
official/nlp/modeling/layers/reuse_transformer.py on lines 154..157
official/nlp/modeling/layers/transformer.py on lines 260..263
official/nlp/modeling/layers/transformer_scaffold.py on lines 142..145
official/nlp/modeling/layers/transformer_xl.py on lines 142..145
official/projects/detr/modeling/transformer.py on lines 256..259
official/projects/detr/modeling/transformer.py on lines 670..673

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 36.

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 7 locations. Consider refactoring.
Open

    if hidden_size % self._num_heads != 0:
      raise ValueError(
          "The input size (%d) is not a multiple of the number of attention "
          "heads (%d)" % (hidden_size, self._num_heads))
Severity: Major
Found in official/nlp/modeling/layers/transformer_scaffold.py and 6 other locations - About 50 mins to fix
official/nlp/modeling/layers/reuse_transformer.py on lines 154..157
official/nlp/modeling/layers/tn_transformer_expand_condense.py on lines 127..130
official/nlp/modeling/layers/transformer.py on lines 260..263
official/nlp/modeling/layers/transformer_xl.py on lines 142..145
official/projects/detr/modeling/transformer.py on lines 256..259
official/projects/detr/modeling/transformer.py on lines 670..673

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 36.

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 7 locations. Consider refactoring.
Open

      if hidden_size % self._num_heads != 0:
        raise ValueError(
            "The input size (%d) is not a multiple of the number of attention "
            "heads (%d)" % (hidden_size, self._num_heads))
Severity: Major
Found in official/nlp/modeling/layers/reuse_transformer.py and 6 other locations - About 50 mins to fix
official/nlp/modeling/layers/tn_transformer_expand_condense.py on lines 127..130
official/nlp/modeling/layers/transformer.py on lines 260..263
official/nlp/modeling/layers/transformer_scaffold.py on lines 142..145
official/nlp/modeling/layers/transformer_xl.py on lines 142..145
official/projects/detr/modeling/transformer.py on lines 256..259
official/projects/detr/modeling/transformer.py on lines 670..673

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 36.

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 7 locations. Consider refactoring.
Open

    if hidden_size % self.num_attention_heads != 0:
      raise ValueError(
          "The hidden size (%d) is not a multiple of the number of attention "
          "heads (%d)" % (hidden_size, self.num_attention_heads))
Severity: Major
Found in official/projects/detr/modeling/transformer.py and 6 other locations - About 50 mins to fix
official/nlp/modeling/layers/reuse_transformer.py on lines 154..157
official/nlp/modeling/layers/tn_transformer_expand_condense.py on lines 127..130
official/nlp/modeling/layers/transformer.py on lines 260..263
official/nlp/modeling/layers/transformer_scaffold.py on lines 142..145
official/nlp/modeling/layers/transformer_xl.py on lines 142..145
official/projects/detr/modeling/transformer.py on lines 256..259

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 36.

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 6 locations. Consider refactoring.
Open

      images_r_diff1 = tf.squared_difference(
          tf.cast(images_r, dtype=tf.float32),
          tf.cast(images_gray_r, dtype=tf.float32))
Severity: Major
Found in research/object_detection/core/preprocessor_test.py and 5 other locations - About 50 mins to fix
research/object_detection/core/preprocessor_test.py on lines 1084..1086
research/object_detection/core/preprocessor_test.py on lines 1088..1090
research/object_detection/core/preprocessor_test.py on lines 1091..1093
research/object_detection/core/preprocessor_test.py on lines 1095..1097
research/object_detection/core/preprocessor_test.py on lines 1098..1100

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 36.

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 6 locations. Consider refactoring.
Open

      images_r_diff2 = tf.squared_difference(
          tf.cast(images_gray_r, dtype=tf.float32),
          tf.cast(images_gray_g, dtype=tf.float32))
Severity: Major
Found in research/object_detection/core/preprocessor_test.py and 5 other locations - About 50 mins to fix
research/object_detection/core/preprocessor_test.py on lines 1081..1083
research/object_detection/core/preprocessor_test.py on lines 1088..1090
research/object_detection/core/preprocessor_test.py on lines 1091..1093
research/object_detection/core/preprocessor_test.py on lines 1095..1097
research/object_detection/core/preprocessor_test.py on lines 1098..1100

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 36.

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