tensorflow/models

View on GitHub
research/slim/deployment/model_deploy_test.py

Summary

Maintainability
F
6 days
Test Coverage

File model_deploy_test.py has 454 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Severity: Minor
Found in research/slim/deployment/model_deploy_test.py - About 6 hrs to fix

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

      def setUp(self):
        # Create an easy training set:
        np.random.seed(0)
    
        self._inputs = np.zeros((16, 4))
    Severity: Major
    Found in research/slim/deployment/model_deploy_test.py and 2 other locations - About 1 day to fix
    research/slim/deployment/model_deploy_test.py on lines 171..181
    research/slim/deployment/model_deploy_test.py on lines 318..328

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

    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

      def setUp(self):
        # Create an easy training set:
        np.random.seed(0)
    
        self._inputs = np.zeros((16, 4))
    Severity: Major
    Found in research/slim/deployment/model_deploy_test.py and 2 other locations - About 1 day to fix
    research/slim/deployment/model_deploy_test.py on lines 171..181
    research/slim/deployment/model_deploy_test.py on lines 467..477

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

    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

      def setUp(self):
        # Create an easy training set:
        np.random.seed(0)
    
        self._inputs = np.zeros((16, 4))
    Severity: Major
    Found in research/slim/deployment/model_deploy_test.py and 2 other locations - About 1 day to fix
    research/slim/deployment/model_deploy_test.py on lines 318..328
    research/slim/deployment/model_deploy_test.py on lines 467..477

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

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

        with tf.device(deploy_config.variables_device()):
          a = tf.Variable(0)
          b = tf.Variable(0)
          c = tf.no_op()
          d = slim.variable('a', [],
    Severity: Major
    Found in research/slim/deployment/model_deploy_test.py and 1 other location - About 3 hrs to fix
    research/slim/deployment/model_deploy_test.py on lines 74..79

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

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

        with tf.device(deploy_config.variables_device()):
          a = tf.Variable(0)
          b = tf.Variable(0)
          c = tf.no_op()
          d = slim.variable('a', [],
    Severity: Major
    Found in research/slim/deployment/model_deploy_test.py and 1 other location - About 3 hrs to fix
    research/slim/deployment/model_deploy_test.py on lines 133..138

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

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

          def ModelFn():
            inputs = tf.constant(1.0, shape=(10, 20), dtype=tf.float32)
            reg = slim.l2_regularizer(0.001)
            slim.fully_connected(inputs, 30, weights_regularizer=reg)
    Severity: Major
    Found in research/slim/deployment/model_deploy_test.py and 1 other location - About 2 hrs to fix
    research/slim/deployment/model_deploy_test.py on lines 536..539

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

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

          def ModelFn():
            inputs = tf.constant(1.0, shape=(10, 20), dtype=tf.float32)
            reg = slim.l2_regularizer(0.001)
            slim.fully_connected(inputs, 30, weights_regularizer=reg)
    Severity: Major
    Found in research/slim/deployment/model_deploy_test.py and 1 other location - About 2 hrs to fix
    research/slim/deployment/model_deploy_test.py on lines 555..558

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

    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

          for v in slim.get_variables():
            self.assertDeviceEqual(v.device, 'CPU:0')
            self.assertDeviceEqual(v.value().device, 'CPU:0')
    Severity: Major
    Found in research/slim/deployment/model_deploy_test.py and 2 other locations - About 1 hr to fix
    research/slim/deployment/model_deploy_test.py on lines 198..200
    research/slim/deployment/model_deploy_test.py on lines 224..226

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

    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

          for v in slim.get_variables():
            self.assertDeviceEqual(v.device, 'CPU:0')
            self.assertDeviceEqual(v.value().device, 'CPU:0')
    Severity: Major
    Found in research/slim/deployment/model_deploy_test.py and 2 other locations - About 1 hr to fix
    research/slim/deployment/model_deploy_test.py on lines 198..200
    research/slim/deployment/model_deploy_test.py on lines 250..252

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

    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

          for v in slim.get_variables():
            self.assertDeviceEqual(v.device, 'CPU:0')
            self.assertDeviceEqual(v.value().device, 'CPU:0')
    Severity: Major
    Found in research/slim/deployment/model_deploy_test.py and 2 other locations - About 1 hr to fix
    research/slim/deployment/model_deploy_test.py on lines 224..226
    research/slim/deployment/model_deploy_test.py on lines 250..252

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

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

          for g, v in grads_and_vars:
            self.assertDeviceEqual(g.device, '/job:worker/device:GPU:0')
            self.assertDeviceEqual(v.device, '/job:ps/task:0/CPU:0')
    Severity: Major
    Found in research/slim/deployment/model_deploy_test.py and 4 other locations - About 35 mins to fix
    research/slim/deployment/model_deploy_test.py on lines 352..354
    research/slim/deployment/model_deploy_test.py on lines 378..380
    research/slim/deployment/model_deploy_test.py on lines 405..407
    research/slim/deployment/model_deploy_test.py on lines 433..435

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

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

          for g, v in grads_and_vars:
            self.assertDeviceEqual(g.device, '')
            self.assertDeviceEqual(v.device, 'CPU:0')
    Severity: Major
    Found in research/slim/deployment/model_deploy_test.py and 4 other locations - About 35 mins to fix
    research/slim/deployment/model_deploy_test.py on lines 352..354
    research/slim/deployment/model_deploy_test.py on lines 378..380
    research/slim/deployment/model_deploy_test.py on lines 433..435
    research/slim/deployment/model_deploy_test.py on lines 460..462

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

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

          for g, v in grads_and_vars:
            self.assertDeviceEqual(g.device, 'GPU:0')
            self.assertDeviceEqual(v.device, 'CPU:0')
    Severity: Major
    Found in research/slim/deployment/model_deploy_test.py and 4 other locations - About 35 mins to fix
    research/slim/deployment/model_deploy_test.py on lines 378..380
    research/slim/deployment/model_deploy_test.py on lines 405..407
    research/slim/deployment/model_deploy_test.py on lines 433..435
    research/slim/deployment/model_deploy_test.py on lines 460..462

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

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

          for g, v in grads_and_vars:
            self.assertDeviceEqual(g.device, '')
            self.assertDeviceEqual(v.device, 'CPU:0')
    Severity: Major
    Found in research/slim/deployment/model_deploy_test.py and 4 other locations - About 35 mins to fix
    research/slim/deployment/model_deploy_test.py on lines 352..354
    research/slim/deployment/model_deploy_test.py on lines 378..380
    research/slim/deployment/model_deploy_test.py on lines 405..407
    research/slim/deployment/model_deploy_test.py on lines 460..462

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

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

          for g, v in grads_and_vars:
            self.assertDeviceEqual(g.device, 'GPU:0')
            self.assertDeviceEqual(v.device, 'CPU:0')
    Severity: Major
    Found in research/slim/deployment/model_deploy_test.py and 4 other locations - About 35 mins to fix
    research/slim/deployment/model_deploy_test.py on lines 352..354
    research/slim/deployment/model_deploy_test.py on lines 405..407
    research/slim/deployment/model_deploy_test.py on lines 433..435
    research/slim/deployment/model_deploy_test.py on lines 460..462

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

    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

    There are no issues that match your filters.

    Category
    Status