tensorflow/tensorflow

View on GitHub
tensorflow/python/grappler/layout_optimizer_test.py

Summary

Maintainability
F
3 wks
Test Coverage

File layout_optimizer_test.py has 1710 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2017 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: Major
Found in tensorflow/python/grappler/layout_optimizer_test.py - About 4 days to fix

    LayoutOptimizerTest has 67 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class LayoutOptimizerTest(test.TestCase):
      """Tests the Grappler layout optimizer."""
    
      def _assert_trans_nchw_to_nhwc(self, name, nodes):
        self.assertIn(name + '-TransposeNCHWToNHWC-LayoutOptimizer', nodes)
    Severity: Major
    Found in tensorflow/python/grappler/layout_optimizer_test.py - About 1 day to fix

      Function testFill has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def testFill(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = array_ops.placeholder(dtype='float32')
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 55 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testBatchNorm3D has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testBatchNorm3D(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x_3d = random_ops.truncated_normal([1, 4, 2, 3, 3], seed=0)
            filters = random_ops.truncated_normal([2, 2, 2, 3, 3], seed=0)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testShapeNFollowedByNotConvertibleNodeReshape has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testShapeNFollowedByNotConvertibleNodeReshape(self):
          if test.is_gpu_available(cuda_only=True):
            x = array_ops.placeholder(dtype='float32')
            conv = _two_layer_model(x)
            conv_reshape = array_ops.reshape(conv, [1, 1, 1, -1])
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testSqueezeAlongNHW has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testSqueezeAlongNHW(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testReduceSumAlongCKeepDims has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testReduceSumAlongCKeepDims(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testShapeN has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testShapeN(self):
          if test.is_gpu_available(cuda_only=True):
            x = array_ops.placeholder(dtype='float32')
            conv = _two_layer_model(x)
            shapen = array_ops.shape_n([conv, conv])
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testBinaryOpSecondPort has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testBinaryOpSecondPort(self):
          if test.is_gpu_available(cuda_only=True):
            output = _model_with_second_port()
      
            with session.Session(config=_get_config(False)) as sess:
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testCast has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testCast(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testReduceSumAlongNHW has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testReduceSumAlongNHW(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testSelectOpConditionUnknownShape has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testSelectOpConditionUnknownShape(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testMaxPoolGradV2 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testMaxPoolGradV2(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testBatchNormGrad3D has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testBatchNormGrad3D(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x_3d = random_ops.truncated_normal([1, 4, 2, 3, 3], seed=0)
            filters = random_ops.truncated_normal([2, 2, 2, 3, 3], seed=0)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testLoopWithVecAnd4D has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testLoopWithVecAnd4D(self):
          if test.is_gpu_available(cuda_only=True):
            output = _loop_with_vec_and_4d()
      
            with session.Session(config=_get_config(False)) as sess:
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testPadWithConstPaddings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testPadWithConstPaddings(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testSqueeze has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testSqueeze(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testLeakyReluGrad has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testLeakyReluGrad(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([4, 14, 14, 1], seed=0)
            w = random_ops.truncated_normal([2, 2, 1, 1], seed=0)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testSliceWithNonConstAxis has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testSliceWithNonConstAxis(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testStridedSliceGradWithNonConstAxis has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testStridedSliceGradWithNonConstAxis(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testLoop has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testLoop(self):
          if test.is_gpu_available(cuda_only=True):
            output = _loop()
      
            with session.Session(config=_get_config(False)) as sess:
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testLoopWithBranch has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testLoopWithBranch(self):
          if test.is_gpu_available(cuda_only=True):
            output = _loop_with_branch()
      
            with session.Session(config=_get_config(False)) as sess:
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testReduceSumAlongHWC has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testReduceSumAlongHWC(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testTile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testTile(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testLeakyRelu has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testLeakyRelu(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([4, 14, 14, 1], seed=0)
            w = random_ops.truncated_normal([2, 2, 1, 2], seed=0)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testSplitWithNonConstAxis has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testSplitWithNonConstAxis(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testSelectOpScalarCondition has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testSelectOpScalarCondition(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testLeakyReluGradFor5DTensors has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testLeakyReluGradFor5DTensors(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 4, 2, 3, 3], seed=0)
            w = random_ops.truncated_normal([2, 2, 2, 3, 3], seed=0)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testSplitVWithNonConstAxis has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testSplitVWithNonConstAxis(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testReverseWithConstDims has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testReverseWithConstDims(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testReverseWithNonConstDims has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testReverseWithNonConstDims(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testReduceOpsFor5DTensors has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testReduceOpsFor5DTensors(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 4, 2, 3, 3], seed=0)
            w = random_ops.truncated_normal([2, 2, 2, 3, 3], seed=0)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testStridedSliceWithMask1011 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testStridedSliceWithMask1011(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testSelectOp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testSelectOp(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testStridedSliceWithMask0111 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testStridedSliceWithMask0111(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testTwoConvLayers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testTwoConvLayers(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            output = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testSqueezeAlongHW has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testSqueezeAlongHW(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testPadWithNonConstPaddings has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testPadWithNonConstPaddings(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testConcatWithControlDependency has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testConcatWithControlDependency(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testMaxPoolV2 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testMaxPoolV2(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testStridedSliceWithNonConstAxis has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testStridedSliceWithNonConstAxis(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testReduceSum has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testReduceSum(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testReduceSumAlongC has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testReduceSumAlongC(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testReduceSumAlongHKeepDims has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testReduceSumAlongHKeepDims(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testReduceSumAlongWCKeepDims has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testReduceSumAlongWCKeepDims(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
            conv = _two_layer_model(x)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function testBinaryOpsFor5DTensors has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def testBinaryOpsFor5DTensors(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 4, 2, 3, 3], seed=0)
            w = random_ops.truncated_normal([2, 2, 2, 3, 3], seed=0)
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py - About 25 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

        @test_util.deprecated_graph_mode_only
        def testReduceSumAlongNHW(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 1 other location - About 2 days to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 564..592

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

      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

        @test_util.deprecated_graph_mode_only
        def testReduceSumAlongHWC(self):
          if test.is_gpu_available(cuda_only=True):
            random_seed.set_random_seed(0)
            x = random_ops.truncated_normal([1, 784], seed=0)
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 1 other location - About 2 days to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 594..622

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

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

        @test_util.deprecated_graph_mode_only
        def testLoopWithVecAnd4D(self):
          if test.is_gpu_available(cuda_only=True):
            output = _loop_with_vec_and_4d()
      
      
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 2 other locations - About 1 day to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1991..2014
      tensorflow/python/grappler/layout_optimizer_test.py on lines 2041..2064

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

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

        @test_util.deprecated_graph_mode_only
        def testLoopWithBranch(self):
          if test.is_gpu_available(cuda_only=True):
            output = _loop_with_branch()
      
      
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 2 other locations - About 1 day to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 2016..2039
      tensorflow/python/grappler/layout_optimizer_test.py on lines 2041..2064

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

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

        @test_util.deprecated_graph_mode_only
        def testBinaryOpSecondPort(self):
          if test.is_gpu_available(cuda_only=True):
            output = _model_with_second_port()
      
      
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 2 other locations - About 1 day to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1991..2014
      tensorflow/python/grappler/layout_optimizer_test.py on lines 2016..2039

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

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

      def _loop():
        random_seed.set_random_seed(0)
        x1 = random_ops.truncated_normal([1, 784], seed=0)
        x2 = random_ops.truncated_normal([1, 784], seed=0)
        x3 = random_ops.truncated_normal([1, 784], seed=0)
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 2 other locations - About 7 hrs to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 123..131
      tensorflow/python/grappler/layout_optimizer_test.py on lines 134..142

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

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

      def _loop_with_vec_and_4d():
        random_seed.set_random_seed(0)
        x1 = random_ops.truncated_normal([1, 784], seed=0)
        x2 = random_ops.truncated_normal([1, 784], seed=0)
        x3 = random_ops.truncated_normal([1, 784], seed=0)
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 2 other locations - About 7 hrs to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 112..120
      tensorflow/python/grappler/layout_optimizer_test.py on lines 123..131

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

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

      def _loop_with_branch():
        random_seed.set_random_seed(0)
        x1 = random_ops.truncated_normal([1, 784], seed=0)
        x2 = random_ops.truncated_normal([1, 784], seed=0)
        x3 = random_ops.truncated_normal([1, 784], seed=0)
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 2 other locations - About 7 hrs to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 112..120
      tensorflow/python/grappler/layout_optimizer_test.py on lines 134..142

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

      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 node in optimized_graph.node:
            if node.op in [
                'DepthwiseConv2dNative', 'DepthwiseConv2dNativeBackpropFilter',
                'DepthwiseConv2dNativeBackpropInput'
            ]:
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 1 other location - About 2 hrs to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 2078..2081

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

      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 node in optimized_graph.node:
            if node.op in ['Conv2D', 'Conv2DBackpropFilter', 'Conv2DBackpropInput']:
              found += 1
              self.assertEqual(node.attr['data_format'].s, b'NCHW')
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 1 other location - About 2 hrs to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 2096..2102

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

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

          with session.Session(config=_get_config()) as sess:
            metadata = config_pb2.RunMetadata()
            output_val = sess.run(output, run_metadata=metadata, feed_dict={h: x_val})
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 1 hr to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 835..838
      tensorflow/python/grappler/layout_optimizer_test.py on lines 878..881
      tensorflow/python/grappler/layout_optimizer_test.py on lines 948..951
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1018..1021
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1080..1083
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1118..1121
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1156..1159
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1611..1614
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1651..1654
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1686..1689
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1801..1804
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1838..1841
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1874..1876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1946..1949

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

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

            with session.Session(config=_get_config()) as sess:
              metadata = config_pb2.RunMetadata()
              output_val = sess.run(
                  output, run_metadata=metadata, feed_dict={condition: condition_val})
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 1 hr to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 835..838
      tensorflow/python/grappler/layout_optimizer_test.py on lines 878..881
      tensorflow/python/grappler/layout_optimizer_test.py on lines 948..951
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1080..1083
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1118..1121
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1156..1159
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1611..1614
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1651..1654
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1686..1689
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1801..1804
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1838..1841
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1874..1876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1912..1914
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1946..1949

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

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

            with session.Session(config=_get_config()) as sess:
              metadata = config_pb2.RunMetadata()
              output_val = sess.run(
                  output, run_metadata=metadata, feed_dict={
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 1 hr to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 835..838
      tensorflow/python/grappler/layout_optimizer_test.py on lines 878..881
      tensorflow/python/grappler/layout_optimizer_test.py on lines 948..951
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1018..1021
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1080..1083
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1118..1121
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1156..1159
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1611..1614
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1651..1654
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1801..1804
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1838..1841
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1874..1876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1912..1914
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1946..1949

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

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

            with session.Session(config=_get_config()) as sess:
              metadata = config_pb2.RunMetadata()
              output_val = sess.run(
                  output, run_metadata=metadata, feed_dict={
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 1 hr to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 835..838
      tensorflow/python/grappler/layout_optimizer_test.py on lines 878..881
      tensorflow/python/grappler/layout_optimizer_test.py on lines 948..951
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1018..1021
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1080..1083
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1118..1121
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1156..1159
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1611..1614
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1651..1654
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1686..1689
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1838..1841
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1874..1876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1912..1914
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1946..1949

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

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

            with session.Session(config=_get_config()) as sess:
              metadata = config_pb2.RunMetadata()
              output_val = sess.run(
                  output, run_metadata=metadata, feed_dict={
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 1 hr to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 835..838
      tensorflow/python/grappler/layout_optimizer_test.py on lines 878..881
      tensorflow/python/grappler/layout_optimizer_test.py on lines 948..951
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1018..1021
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1118..1121
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1156..1159
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1611..1614
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1651..1654
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1686..1689
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1801..1804
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1838..1841
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1874..1876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1912..1914
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1946..1949

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

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

            with session.Session(config=_get_config()) as sess:
              metadata = config_pb2.RunMetadata()
              output_val = sess.run(
                  output, run_metadata=metadata, feed_dict={
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 1 hr to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 835..838
      tensorflow/python/grappler/layout_optimizer_test.py on lines 878..881
      tensorflow/python/grappler/layout_optimizer_test.py on lines 948..951
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1018..1021
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1080..1083
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1118..1121
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1156..1159
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1651..1654
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1686..1689
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1801..1804
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1838..1841
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1874..1876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1912..1914
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1946..1949

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

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

          with session.Session(config=_get_config()) as sess:
            metadata = config_pb2.RunMetadata()
            output_val = sess.run(
                output, run_metadata=metadata, feed_dict={size: size_val})
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 1 hr to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 835..838
      tensorflow/python/grappler/layout_optimizer_test.py on lines 878..881
      tensorflow/python/grappler/layout_optimizer_test.py on lines 948..951
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1018..1021
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1080..1083
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1118..1121
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1156..1159
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1611..1614
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1686..1689
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1801..1804
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1838..1841
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1874..1876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1912..1914
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1946..1949

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

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

            with session.Session(config=_get_config()) as sess:
              metadata = config_pb2.RunMetadata()
              output_val = sess.run(
                  output, run_metadata=metadata, feed_dict={
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 1 hr to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 835..838
      tensorflow/python/grappler/layout_optimizer_test.py on lines 948..951
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1018..1021
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1080..1083
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1118..1121
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1156..1159
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1611..1614
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1651..1654
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1686..1689
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1801..1804
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1838..1841
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1874..1876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1912..1914
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1946..1949

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

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

            with session.Session(config=_get_config()) as sess:
              metadata = config_pb2.RunMetadata()
              output_val = sess.run(
                  output, run_metadata=metadata, feed_dict={
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 1 hr to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 835..838
      tensorflow/python/grappler/layout_optimizer_test.py on lines 878..881
      tensorflow/python/grappler/layout_optimizer_test.py on lines 948..951
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1018..1021
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1080..1083
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1118..1121
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1156..1159
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1611..1614
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1651..1654
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1686..1689
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1801..1804
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1874..1876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1912..1914
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1946..1949

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

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

          with session.Session(config=_get_config()) as sess:
            metadata = config_pb2.RunMetadata()
            output_val = sess.run(output, run_metadata=metadata, feed_dict={h: x_val})
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 1 hr to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 835..838
      tensorflow/python/grappler/layout_optimizer_test.py on lines 878..881
      tensorflow/python/grappler/layout_optimizer_test.py on lines 948..951
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1018..1021
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1080..1083
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1118..1121
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1156..1159
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1611..1614
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1651..1654
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1686..1689
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1801..1804
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1838..1841
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1912..1914
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1946..1949

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

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

            with session.Session(config=_get_config()) as sess:
              metadata = config_pb2.RunMetadata()
              output_val = sess.run(
                  output, run_metadata=metadata, feed_dict={
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 1 hr to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 878..881
      tensorflow/python/grappler/layout_optimizer_test.py on lines 948..951
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1018..1021
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1080..1083
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1118..1121
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1156..1159
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1611..1614
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1651..1654
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1686..1689
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1801..1804
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1838..1841
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1874..1876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1912..1914
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1946..1949

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

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

            with session.Session(config=_get_config()) as sess:
              metadata = config_pb2.RunMetadata()
              output_val = sess.run(
                  output, run_metadata=metadata, feed_dict={
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 1 hr to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 835..838
      tensorflow/python/grappler/layout_optimizer_test.py on lines 878..881
      tensorflow/python/grappler/layout_optimizer_test.py on lines 948..951
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1018..1021
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1080..1083
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1156..1159
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1611..1614
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1651..1654
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1686..1689
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1801..1804
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1838..1841
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1874..1876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1912..1914
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1946..1949

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

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

            with session.Session(config=_get_config()) as sess:
              metadata = config_pb2.RunMetadata()
              output_val = sess.run(
                  output, run_metadata=metadata, feed_dict={x: x_val})
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 1 hr to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 835..838
      tensorflow/python/grappler/layout_optimizer_test.py on lines 878..881
      tensorflow/python/grappler/layout_optimizer_test.py on lines 948..951
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1018..1021
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1080..1083
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1118..1121
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1156..1159
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1611..1614
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1651..1654
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1686..1689
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1801..1804
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1838..1841
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1874..1876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1912..1914

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

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

            with session.Session(config=_get_config()) as sess:
              metadata = config_pb2.RunMetadata()
              output_val = sess.run(
                  output, run_metadata=metadata, feed_dict={
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 1 hr to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 835..838
      tensorflow/python/grappler/layout_optimizer_test.py on lines 878..881
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1018..1021
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1080..1083
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1118..1121
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1156..1159
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1611..1614
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1651..1654
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1686..1689
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1801..1804
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1838..1841
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1874..1876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1912..1914
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1946..1949

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

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

            with session.Session(config=_get_config()) as sess:
              metadata = config_pb2.RunMetadata()
              output_val = sess.run(
                  output, run_metadata=metadata, feed_dict={
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 1 hr to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 835..838
      tensorflow/python/grappler/layout_optimizer_test.py on lines 878..881
      tensorflow/python/grappler/layout_optimizer_test.py on lines 948..951
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1018..1021
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1080..1083
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1118..1121
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1611..1614
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1651..1654
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1686..1689
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1801..1804
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1838..1841
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1874..1876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1912..1914
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1946..1949

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

      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 session.Session(config=_get_config()) as sess:
              metadata = config_pb2.RunMetadata()
              output_val = sess.run(output, run_metadata=metadata, feed_dict={dim: 3})
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 355..357

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

      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 session.Session(config=_get_config()) as sess:
              metadata = config_pb2.RunMetadata()
              output_val = sess.run(output, run_metadata=metadata, feed_dict={dim: 3})
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 322..324

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

      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 _max_pool_2x2(x):
        """Downsamples a feature map by 2X."""
        return nn.max_pool(
            x, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME')
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 1 other location - About 1 hr to fix
      tensorflow/python/grappler/auto_mixed_precision_test.py on lines 80..83

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

          with session.Session(config=_get_config(False)) as sess:
            output_val_ref = sess.run(output, feed_dict={h: x_val})
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 55 mins to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 832..833
      tensorflow/python/grappler/layout_optimizer_test.py on lines 875..876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 945..946
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1015..1016
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1077..1078
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1115..1116
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1153..1154
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1608..1609
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1648..1649
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1683..1684
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1798..1799
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1835..1836
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1909..1910
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1943..1944

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

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

          with session.Session(config=_get_config(False)) as sess:
            output_val_ref = sess.run(output, feed_dict={h: x_val})
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 55 mins to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 832..833
      tensorflow/python/grappler/layout_optimizer_test.py on lines 875..876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 945..946
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1015..1016
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1077..1078
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1115..1116
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1153..1154
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1608..1609
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1648..1649
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1683..1684
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1798..1799
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1835..1836
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1871..1872
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1943..1944

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

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

            with session.Session(config=_get_config(False)) as sess:
              output_val_ref = sess.run(output, feed_dict={strides: strides_val})
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 55 mins to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 832..833
      tensorflow/python/grappler/layout_optimizer_test.py on lines 875..876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 945..946
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1015..1016
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1077..1078
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1115..1116
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1608..1609
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1648..1649
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1683..1684
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1798..1799
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1835..1836
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1871..1872
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1909..1910
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1943..1944

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

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

            with session.Session(config=_get_config(False)) as sess:
              output_val_ref = sess.run(output, feed_dict={dims: dims_val})
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 55 mins to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 832..833
      tensorflow/python/grappler/layout_optimizer_test.py on lines 875..876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1015..1016
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1077..1078
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1115..1116
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1153..1154
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1608..1609
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1648..1649
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1683..1684
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1798..1799
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1835..1836
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1871..1872
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1909..1910
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1943..1944

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

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

            with session.Session(config=_get_config(False)) as sess:
              output_val_ref = sess.run(output, feed_dict={x: x_val})
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 55 mins to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 875..876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 945..946
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1015..1016
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1077..1078
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1115..1116
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1153..1154
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1608..1609
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1648..1649
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1683..1684
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1798..1799
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1835..1836
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1871..1872
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1909..1910
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1943..1944

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

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

            with session.Session(config=_get_config(False)) as sess:
              output_val_ref = sess.run(output, feed_dict={end: end_val})
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 55 mins to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 832..833
      tensorflow/python/grappler/layout_optimizer_test.py on lines 875..876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 945..946
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1015..1016
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1077..1078
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1115..1116
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1153..1154
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1608..1609
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1648..1649
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1798..1799
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1835..1836
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1871..1872
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1909..1910
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1943..1944

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

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

            with session.Session(config=_get_config(False)) as sess:
              output_val_ref = sess.run(output, feed_dict={x: x_val})
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 55 mins to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 832..833
      tensorflow/python/grappler/layout_optimizer_test.py on lines 875..876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 945..946
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1015..1016
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1077..1078
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1115..1116
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1153..1154
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1608..1609
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1648..1649
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1683..1684
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1798..1799
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1835..1836
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1871..1872
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1909..1910

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

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

          with session.Session(config=_get_config(False)) as sess:
            output_val_ref = sess.run(output, feed_dict={size: size_val})
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 55 mins to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 832..833
      tensorflow/python/grappler/layout_optimizer_test.py on lines 875..876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 945..946
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1015..1016
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1077..1078
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1115..1116
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1153..1154
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1608..1609
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1683..1684
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1798..1799
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1835..1836
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1871..1872
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1909..1910
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1943..1944

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

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

            with session.Session(config=_get_config(False)) as sess:
              output_val_ref = sess.run(output, feed_dict={multiple: multiple_val})
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 55 mins to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 832..833
      tensorflow/python/grappler/layout_optimizer_test.py on lines 945..946
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1015..1016
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1077..1078
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1115..1116
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1153..1154
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1608..1609
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1648..1649
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1683..1684
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1798..1799
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1835..1836
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1871..1872
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1909..1910
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1943..1944

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

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

            with session.Session(config=_get_config(False)) as sess:
              output_val_ref = sess.run(output, feed_dict={x: x_val})
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 55 mins to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 832..833
      tensorflow/python/grappler/layout_optimizer_test.py on lines 875..876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 945..946
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1015..1016
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1077..1078
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1115..1116
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1153..1154
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1608..1609
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1648..1649
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1683..1684
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1798..1799
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1871..1872
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1909..1910
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1943..1944

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

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

            with session.Session(config=_get_config(False)) as sess:
              output_val_ref = sess.run(output, feed_dict={condition: condition_val})
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 55 mins to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 832..833
      tensorflow/python/grappler/layout_optimizer_test.py on lines 875..876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 945..946
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1077..1078
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1115..1116
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1153..1154
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1608..1609
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1648..1649
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1683..1684
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1798..1799
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1835..1836
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1871..1872
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1909..1910
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1943..1944

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

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

            with session.Session(config=_get_config(False)) as sess:
              output_val_ref = sess.run(output, feed_dict={strides: strides_val})
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 55 mins to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 832..833
      tensorflow/python/grappler/layout_optimizer_test.py on lines 875..876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 945..946
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1015..1016
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1077..1078
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1153..1154
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1608..1609
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1648..1649
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1683..1684
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1798..1799
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1835..1836
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1871..1872
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1909..1910
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1943..1944

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

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

            with session.Session(config=_get_config(False)) as sess:
              output_val_ref = sess.run(output, feed_dict={end: end_val})
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 55 mins to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 832..833
      tensorflow/python/grappler/layout_optimizer_test.py on lines 875..876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 945..946
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1015..1016
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1077..1078
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1115..1116
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1153..1154
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1608..1609
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1648..1649
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1683..1684
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1835..1836
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1871..1872
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1909..1910
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1943..1944

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

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

            with session.Session(config=_get_config(False)) as sess:
              output_val_ref = sess.run(output, feed_dict={size: size_val})
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 55 mins to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 832..833
      tensorflow/python/grappler/layout_optimizer_test.py on lines 875..876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 945..946
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1015..1016
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1077..1078
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1115..1116
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1153..1154
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1648..1649
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1683..1684
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1798..1799
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1835..1836
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1871..1872
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1909..1910
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1943..1944

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

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

            with session.Session(config=_get_config(False)) as sess:
              output_val_ref = sess.run(output, feed_dict={paddings: paddings_val})
      Severity: Major
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 14 other locations - About 55 mins to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 832..833
      tensorflow/python/grappler/layout_optimizer_test.py on lines 875..876
      tensorflow/python/grappler/layout_optimizer_test.py on lines 945..946
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1015..1016
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1115..1116
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1153..1154
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1608..1609
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1648..1649
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1683..1684
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1798..1799
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1835..1836
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1871..1872
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1909..1910
      tensorflow/python/grappler/layout_optimizer_test.py on lines 1943..1944

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

      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 session.Session(config=_get_config(False)) as sess:
              output_val_ref = sess.run(output, feed_dict={dim: 3})
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 1 other location - About 55 mins to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 352..353

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

      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 session.Session(config=_get_config(False)) as sess:
              output_val_ref = sess.run(output, feed_dict={dim: 3})
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 1 other location - About 55 mins to fix
      tensorflow/python/grappler/layout_optimizer_test.py on lines 319..320

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

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

      def _conv2d(x, w):
        """Returns a 2d convolution layer with full stride."""
        return nn.conv2d(x, w, strides=[1, 1, 1, 1], padding='SAME')
      Severity: Minor
      Found in tensorflow/python/grappler/layout_optimizer_test.py and 2 other locations - About 30 mins to fix
      tensorflow/python/grappler/auto_mixed_precision_test.py on lines 70..72
      tensorflow/python/grappler/auto_mixed_precision_test.py on lines 140..142

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

      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