deeplearning4j/deeplearning4j

View on GitHub

Showing 13,975 of 13,975 total issues

File LegacyOpMapper.java has 672 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 *  ******************************************************************************
 *  *
 *  *
 *  * This program and the accompanying materials are made available under the

    Method doExec has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
    Open

        public  Double doExec(List<BatchItem<T>> items,INDArray inferenceVector) {
            try(MemoryWorkspace workspace = Nd4j.getWorkspaceManager().scopeOutOfWorkspaces()) {
                if (items.size() > 1) {
                    INDArray targetArray = null;
                    INDArray ngStarterArray = null;

    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

    Method checkGradients has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
    Open

        public static boolean checkGradients(GraphConfig c){
            //Basic sanity checks on input:
            if (c.epsilon <= 0.0 || c.epsilon > 0.1)
                throw new IllegalArgumentException("Invalid epsilon: expect epsilon in range (0,0.1], usually 1e-4 or so");
            if (c.maxRelError <= 0.0 || c.maxRelError > 0.25)

    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 ChartTimeline has 302 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var ChartTimeline = (function (_super) {
        __extends(ChartTimeline, _super);
        function ChartTimeline(jsonStr) {
            var _this = _super.call(this, ComponentType.ChartTimeline, jsonStr) || this;
            _this.render = function (appendToObject) {

      SDNN has 80 methods (exceeds 20 allowed). Consider refactoring.
      Open

      public class SDNN extends SDOps {
        public SDNN(SameDiff sameDiff) {
          super(sameDiff);
        }
      
      

        Method doExec has 299 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public ExecutionResult doExec(DifferentialFunction op,
                                          OpContext opContext,
                                          FrameIter outputFrameIter,
                                          Set<VarId> opInputs, Set<VarId> allIterInputs,
                                          Set<String> constAndPhInputs,

          File NeuralNetConfiguration.java has 665 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /*
           *  ******************************************************************************
           *  *
           *  *
           *  * This program and the accompanying materials are made available under the

            Method invoke has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
            Open

                protected CudaContext invoke(ReduceOp op, OpContext oc, long[] dimension) {
                    val context = AtomicAllocator.getInstance().getDeviceContext();
            
                    INDArray x = getX(op, oc);
                    INDArray y = getY(op, oc);

            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

            Method processClazz has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
            Open

                private void processClazz(Map<String, List<ArgDescriptorProposal>> ret, Set<String> opNamesForDifferentialFunction, Class<?> clazz) {
                    try {
                        Object funcInstance = clazz.newInstance();
                        String name = null;
            
            

            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

            Method getLayerInfoTable has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
            Open

                private static String[][] getLayerInfoTable(String sessionId, int layerIdx, TrainModuleUtils.GraphInfo gi, I18N i18N, boolean noData,
                                                            StatsStorage ss, String wid) {
                    List<String[]> layerInfoRows = new ArrayList<>();
                    layerInfoRows.add(new String[]{i18N.getMessage("train.model.layerinfotable.layerName"),
                            gi.getVertexNames().get(layerIdx)});

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

                public static class ModelParamNamesDecoder
                                implements Iterable<ModelParamNamesDecoder>, java.util.Iterator<ModelParamNamesDecoder> {
                    private static final int HEADER_SIZE = 4;
                    private final GroupSizeEncodingDecoder dimensions = new GroupSizeEncodingDecoder();
                    private StaticInfoDecoder parentMessage;
            deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-ui-model/src/main/java/org/deeplearning4j/ui/model/stats/sbe/UpdateDecoder.java on lines 953..1097
            deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-ui-model/src/main/java/org/deeplearning4j/ui/model/stats/sbe/UpdateDecoder.java on lines 1110..1254

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

            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

                public static class LayerNamesDecoder
                                implements Iterable<LayerNamesDecoder>, java.util.Iterator<LayerNamesDecoder> {
                    private static final int HEADER_SIZE = 4;
                    private final GroupSizeEncodingDecoder dimensions = new GroupSizeEncodingDecoder();
                    private UpdateDecoder parentMessage;
            deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-ui-model/src/main/java/org/deeplearning4j/ui/model/stats/sbe/StaticInfoDecoder.java on lines 788..932
            deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-ui-model/src/main/java/org/deeplearning4j/ui/model/stats/sbe/UpdateDecoder.java on lines 953..1097

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

            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

                public static class ParamNamesDecoder
                                implements Iterable<ParamNamesDecoder>, java.util.Iterator<ParamNamesDecoder> {
                    private static final int HEADER_SIZE = 4;
                    private final GroupSizeEncodingDecoder dimensions = new GroupSizeEncodingDecoder();
                    private UpdateDecoder parentMessage;
            deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-ui-model/src/main/java/org/deeplearning4j/ui/model/stats/sbe/StaticInfoDecoder.java on lines 788..932
            deeplearning4j/deeplearning4j-ui-parent/deeplearning4j-ui-model/src/main/java/org/deeplearning4j/ui/model/stats/sbe/UpdateDecoder.java on lines 1110..1254

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

            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

            Method fit has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
            Open

                public void fit() {
                    val props = Nd4j.getExecutioner().getEnvironmentInformation();
                    if (props.getProperty("backend").equals("CUDA")) {
                        if (Nd4j.getAffinityManager().getNumberOfDevices() > 1)
                            throw new IllegalStateException("Multi-GPU word2vec/doc2vec isn't available atm");

            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

            Method getOutputType has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
            Open

                @Override
                public InputType getOutputType(int layerIndex, InputType... vertexInputs) throws InvalidInputTypeException {
                    if (vertexInputs.length == 1)
                        return vertexInputs[0];
            
            

            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

            Method computeGradientAndScore has a Cognitive Complexity of 74 (exceeds 5 allowed). Consider refactoring.
            Open

                @Override
                public void computeGradientAndScore(LayerWorkspaceMgr workspaceMgr) {
                    //Forward pass through the encoder and mean for P(Z|X)
                    VAEFwdHelper fwd = doForward(true, true, workspaceMgr);
                    IActivation afn = layerConf().getActivationFn();

            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 TransformProcess.java has 655 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /*
             *  ******************************************************************************
             *  *
             *  *
             *  * This program and the accompanying materials are made available under the

              File NativeImageLoader.java has 654 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /*
               *  ******************************************************************************
               *  *
               *  *
               *  * This program and the accompanying materials are made available under the

                File ArgDescriptorParserUtils.java has 651 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /*
                 *  ******************************************************************************
                 *  *
                 *  *
                 *  * This program and the accompanying materials are made available under the

                  Function ChartTimeline has 290 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function ChartTimeline(jsonStr) {
                          var _this = _super.call(this, ComponentType.ChartTimeline, jsonStr) || this;
                          _this.render = function (appendToObject) {
                              var instance = _this;
                              var s = _this.getStyle();
                    Severity
                    Category
                    Status
                    Source
                    Language