deeplearning4j/deeplearning4j

View on GitHub
codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/RNN.kt

Summary

Maintainability
F
6 days
Test Coverage

Method SDRNN has a Cognitive Complexity of 240 (exceeds 20 allowed). Consider refactoring.
Open

fun SDRNN() = Namespace("RNN") {


    val LSTMConfiguration = Config("LSTMConfiguration") {

Severity: Minor
Found in codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/RNN.kt - About 4 days 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

File RNN.kt has 261 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 *  ******************************************************************************
 *  *
 *  *
 *  * This program and the accompanying materials are made available under the
Severity: Minor
Found in codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/RNN.kt - About 2 hrs to fix

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

        Op("sru") {
            javaPackage = namespaceJavaPackage
            javaOpClass = "SRU"
            Input(NUMERIC, "x") { description = "Input, with shape [batchSize, inSize]" }
            Input(NUMERIC, "initialC") { description = "Initial cell state, with shape [batchSize, inSize]" }
    Severity: Major
    Found in codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/RNN.kt and 6 other locations - About 4 hrs to fix
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/CNN.kt on lines 230..245
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/CNN.kt on lines 249..264
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/CNN.kt on lines 269..284
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/CNN.kt on lines 288..302
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/CNN.kt on lines 308..323
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/CNN.kt on lines 344..359

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

    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

            Arg(ENUM, "outAct") {
                possibleValues = listOf("TANH",
                        "RELU",
                        "SIGMOID",
                        "AFFINE",
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/RNN.kt on lines 71..83
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/RNN.kt on lines 86..98

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

    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

            Arg(ENUM, "cellAct") {
                possibleValues = listOf("TANH",
                        "RELU",
                        "SIGMOID",
                        "AFFINE",
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/RNN.kt on lines 71..83
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/RNN.kt on lines 101..113

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

    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

            Arg(ENUM, "gateAct") {
                possibleValues = listOf("TANH",
                        "RELU",
                        "SIGMOID",
                        "AFFINE",
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/RNN.kt on lines 86..98
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/RNN.kt on lines 101..113

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

    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

            Arg(BOOL, "retLastC") {
                description = "indicates whether to return cells state at last time step only,\n" +
                        " in this case shape would be [bS, nOut] (exact shape depends on dataFormat argument)"; defaultValue = false
            }
    Severity: Minor
    Found in codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/RNN.kt and 1 other location - About 35 mins to fix
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/RNN.kt on lines 117..120

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 65.

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

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

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

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

    Refactorings

    Further Reading

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

            Arg(BOOL, "retLastH") {
                description = "indicates whether to return output at last time step only,\n" +
                        " in this case shape would be [bS, nOut] (exact shape depends on dataFormat argument)"; defaultValue = false
            }
    Severity: Minor
    Found in codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/RNN.kt and 1 other location - About 35 mins to fix
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/RNN.kt on lines 121..124

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 65.

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

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

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

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

    Refactorings

    Further Reading

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

            Input(NUMERIC, "recurrentWeights") {description="recurrent weights Wr:\n" +
                    " 1) shapes `[nIn, 4*nOut]` for FWD, BWD " +
                    " 2) shapes `[2, nIn, 4*nOut]` BIDIR_SUM, BIDIR_CONCAT and BIDIR_EXTRA_DIM"}
    Severity: Minor
    Found in codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/RNN.kt and 1 other location - About 35 mins to fix
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/RNN.kt on lines 164..166

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

    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

            Input(NUMERIC, "inputWeights") {description="input weights Wx:\n" +
                    " 1) shapes `[nIn, 4*nOut]` for FWD,BWD " +
                    " 2) shapes `[2, nIn, 4*nOut]` BIDIR_SUM, BIDIR_CONCAT and BIDIR_EXTRA_DIM"}
    Severity: Minor
    Found in codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/RNN.kt and 1 other location - About 35 mins to fix
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/RNN.kt on lines 167..169

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

    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

                possibleValues = listOf("FWD", "BWD", "BIDIR_SUM", "BIDIR_CONCAT", "BIDIR_EXTRA_DIM"); description = "direction <br>\n" +
                    " FWD: 0 = fwd\n" +
                    " BWD: 1 = bwd\n" +
                    " BIDIR_SUM: 2 = bidirectional sum\n" +
                    " BIDIR_CONCAT: 3 = bidirectional concat\n" +
    Severity: Minor
    Found in codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/RNN.kt and 1 other location - About 30 mins to fix
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Image.kt on lines 265..269

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

    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