deeplearning4j/deeplearning4j

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

Summary

Maintainability
F
2 wks
Test Coverage

Method NN has a Cognitive Complexity of 486 (exceeds 20 allowed). Consider refactoring.
Open

fun NN() = Namespace("NN") {
    val convPkg = "org.nd4j.linalg.api.ops.impl.layers.convolution"

    Op("batchNorm") {
        javaPackage = convPkg

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 NeuralNetwork.kt has 477 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/NeuralNetwork.kt - About 7 hrs to fix

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

        Op("topK") {
            javaPackage = "org.nd4j.linalg.api.ops.impl.transforms.custom"
            Input(NUMERIC, "input") { description = "Input data" }
            Arg(NUMERIC, "k") { description = "The number of values to return" }
            Arg(BOOL, "sorted") { description = "Whether to return the values sorted or not" }
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 985..997

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

    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

        Op("reluLayer") {
            javaPackage = "org.nd4j.linalg.api.ops.impl.transforms"
            Input(NUMERIC, "input") { description = "Input data" }
            Input(NUMERIC, "weights") { description = "Weights variable" }
            Input(NUMERIC, "bias") { description = " Bias variable" }
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 355..367

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

    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

        Op("relu6") {
            javaPackage = "org.nd4j.linalg.api.ops.impl.scalar"
            legacy = true
            Input(NUMERIC, "x") { description = "Input" }
            Arg(NUMERIC, "cutoff") { description = "Cutoff value for ReLU operation. Usually 0" }
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1423..1437

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

    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

        Op("leakyReluDerivative") {
            javaPackage = "org.nd4j.linalg.api.ops.impl.transforms.gradient"
            javaOpClass = "LeakyReLUDerivative"
            legacy = true
            Input(NUMERIC, "x") { description = "Input variable" }
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 684..696
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 698..710

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

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

        Op("logSoftmax") {
            javaPackage = "org.nd4j.linalg.api.ops.impl.transforms.custom"
            javaOpClass = "LogSoftMax"
            Input(NUMERIC, "x") { description = "Input" }
            Arg(INT, "dimension") { description = "Dimension along which to apply log softmax" }
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 172..183
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 185..196
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 198..210
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Bitwise.kt on lines 212..224
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1518..1530
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1532..1544
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1546..1558
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1560..1572
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 1003..1014
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 1030..1041
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 2115..2126
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 2129..2140

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

    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

        Op("sigmoidDerivative") {
            javaPackage = "org.nd4j.linalg.api.ops.impl.transforms.gradient"
            Input(NUMERIC, "x") { description = "Input Variable" }
            Input(NUMERIC, "wrt") { description = "Gradient at the output - dL/dOut. Must have same shape as the input" }
            Output(NUMERIC, "output") { description = "Output (gradient at input of sigmoid)" }
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 576..586
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1101..1111

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

    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

        Op("CReLU") {
            javaPackage = "org.nd4j.linalg.api.ops.impl.transforms.custom"
            javaOpClass = "CReLU"
            Input(NUMERIC, "x") { description = "Input variable" }
            Output(NUMERIC, "output") { description = "Output variable" }
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 1017..1027
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDLoss.kt on lines 128..138

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 188.

    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

            Doc(Language.ANY, DocScope.ALL) {
                """
                 This operation performs dot product attention on the given timeseries input with the given queries
                 out = sum(similarity(k_i, q) * v_i)
                
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 508..529

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

    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

            Doc(Language.ANY, DocScope.ALL) {
                """
                 This operation performs dot product attention on the given timeseries input with the given queries
                 out = sum(similarity(k_i, q) * v_i)
                
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 467..488

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

    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

            Doc(Language.ANY, DocScope.ALL) {
                """
                 This performs multi-headed dot product attention on the given timeseries input
                 out = concat(head_1, head_2, ..., head_n) * Wo
                 head_i = dot_product_attention(Wq_i*q, Wk_i*k, Wv_i*v)
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDLoss.kt on lines 220..235

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

    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

        Op("preciseGelu", transformStrict) {
            javaOpClass = "PreciseGELU"
    
            Doc(Language.ANY, DocScope.ALL) {
                """
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 107..117

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

    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

        Op("gelu", transformStrict) {
            javaOpClass = "GELU"
    
            Doc(Language.ANY, DocScope.ALL) {
                """
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 302..312

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

    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

        Op("hardTanh", transformStrict) {
            Doc(Language.ANY, DocScope.ALL) {
                """
                 Element-wise hard tanh function:
                 out[i] = -1 if in[i] <= -1
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1252..1261
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 119..128

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

    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

        Op("hardSigmoid", transformStrict) {
            Doc(Language.ANY, DocScope.ALL) {
                """
                 Element-wise hard sigmoid function:
                 out[i] = 0 if in[i] <= -2.5
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1252..1261
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 130..139

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

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

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

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

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

    Refactorings

    Further Reading

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

            Doc(Language.ANY, DocScope.ALL) {
                """
                 PReLU (Parameterized Rectified Linear Unit) operation.  Like LeakyReLU with a learnable alpha:
                 out[i] = in[i] if in[i] >= 0
                 out[i] = in[i] * alpha[i] otherwise
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 430..441
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 95..104
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 1654..1665
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 1674..1685
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 1763..1774
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 1790..1801

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

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

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

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

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

    Refactorings

    Further Reading

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

            Doc(Language.ANY, DocScope.ALL) {
                """
                 Element-wise exponential linear unit (ELU) function:
                 out = x if x > 0
                 out = a * (exp(x) - 1) if x <= 0
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 430..441
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 323..334
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 1654..1665
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 1674..1685
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 1763..1774
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 1790..1801

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

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

        Op("softsign", transformStrict) {
            javaOpClass = "SoftSign"
            Doc(Language.ANY, DocScope.ALL) {
                """
                 Element-wise softsign function: out = x / (abs(x) + 1)
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 36..43
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 45..52
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 54..61
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 84..91
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 93..100
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 102..109
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 111..118
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 121..128
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 130..137
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 156..163
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 166..173
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 175..182
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 184..191
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 207..214
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 868..875
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 877..884
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 887..894
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 896..903
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 906..913
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 915..922
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 999..1006
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1023..1030
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1032..1039
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1041..1048
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1050..1057
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1059..1066
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1068..1075
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1114..1121
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1123..1130
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1186..1193
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1305..1312
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1314..1321
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1376..1383
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1385..1392
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 385..392

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

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

        Op("softplus", transformStrict) {
            javaOpClass = "SoftPlus"
            Doc(Language.ANY, DocScope.ALL) {
                """
                 Element-wise softplus function: out = log(exp(x) + 1)
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 36..43
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 45..52
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 54..61
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 84..91
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 93..100
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 102..109
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 111..118
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 121..128
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 130..137
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 156..163
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 166..173
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 175..182
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 184..191
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 207..214
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 868..875
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 877..884
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 887..894
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 896..903
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 906..913
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 915..922
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 999..1006
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1023..1030
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1032..1039
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1041..1048
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1050..1057
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1059..1066
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1068..1075
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1114..1121
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1123..1130
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1186..1193
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1305..1312
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1314..1321
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1376..1383
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1385..1392
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 394..401

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

    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(INT, "axis") {
                count = AtLeast(1)
                description = "For 2d CNN activations: 1 for NCHW format activations, or 3 for NHWC format activations.\n" +
                        "For 3d CNN activations: 1 for NCDHW format, 4 for NDHWC\n" +
                        "For 1d/RNN activations: 1 for NCW format, 2 for NWC"
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Image.kt on lines 57..59

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

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

        Op("logSigmoid", transformStrict) {
            Doc(Language.ANY, DocScope.ALL) {
                """
                 Element-wise sigmoid function: out[i] = log(sigmoid(in[i]))
                """.trimIndent()
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 353..359
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 361..367
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 389..395
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 397..403
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 418..424
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 480..486
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 496..502
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 514..520
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 522..528
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 783..789
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 802..808
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 810..816
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1093..1099
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1142..1148
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1150..1156
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1236..1242
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1244..1250
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1263..1269
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1271..1277
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1279..1285
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1287..1293
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1394..1400
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1402..1408
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 349..355

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

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

        Op("sigmoid", transformStrict) {
            Doc(Language.ANY, DocScope.ALL) {
                """
                 Element-wise sigmoid function: out[i] = 1.0/(1+exp(-in[i]))
                """.trimIndent()
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 353..359
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 361..367
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 389..395
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 397..403
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 418..424
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 480..486
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 496..502
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 514..520
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 522..528
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 783..789
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 802..808
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 810..816
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1093..1099
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1142..1148
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1150..1156
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1236..1242
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1244..1250
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1263..1269
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1271..1277
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1279..1285
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1287..1293
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1394..1400
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/Math.kt on lines 1402..1408
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 221..227

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

    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

            val v = Input(NUMERIC, "values") { description = "input 3D array \"values\" of shape [batchSize, featureValues, timesteps]\n" +
                    "or 4D array of shape [batchSize, numHeads, featureValues, timesteps]" }
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 493..494
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 495..496

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

    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

            val q = Input(NUMERIC, "queries") { description = "input 3D array \"queries\" of shape [batchSize, featureKeys, queryCount]\n" +
                    "or 4D array of shape [batchSize, numHeads, featureKeys, queryCount]" }
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 495..496
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 497..498

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

    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

            val k = Input(NUMERIC, "keys") { description = "input 3D array \"keys\" of shape [batchSize, featureKeys, timesteps]\n" +
                    "or 4D array of shape [batchSize, numHeads, featureKeys, timesteps]" }
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 493..494
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 497..498

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

    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

            val dim = Arg(LONG, "dimensions") { count = AtLeast(1); description = "Dimensions to perform layer norm over - dimension=1 for 2d/MLP data, dimension=1,2,3 for CNNs" }
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 153..153
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/SDBaseOps.kt on lines 1275..1275

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

    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

            Signature(q,v,k,queryMask,valueMask, s,dropout,useCausalMask,training)
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 550..550

    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

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

            Signature(q, k, v, wq, wk, wv, wo, m, s)
    codegen/op-codegen/src/main/ops/org/nd4j/codegen/ops/NeuralNetwork.kt on lines 465..465

    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