deeplearning4j/deeplearning4j

View on GitHub

Showing 6,111 of 13,975 total issues

Method iterationDone has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public void iterationDone(Model model, int iteration, int epoch) {

        ModelInfo modelInfo = getModelInfo(model);
        boolean backpropParamsOnly = backpropParamsOnly(model);

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 decode has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public void decode(DirectBuffer buffer) {
        //TODO we could do this more efficiently, with buffer re-use, etc.
        MessageHeaderDecoder dec = new MessageHeaderDecoder();
        UpdateDecoder ud = new UpdateDecoder();

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 backpropGradientHelper has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
Open

    static public Pair<Gradient, INDArray> backpropGradientHelper(final BaseRecurrentLayer layer, final NeuralNetConfiguration conf,
                    final IActivation gateActivationFn, INDArray input, final INDArray recurrentWeights, //Shape: [hiddenLayerSize,4*hiddenLayerSize+3]; order: [wI,wF,wO,wG,wFF,wOO,wGG]
                    final INDArray inputWeights, //Shape: [n^(L-1),4*hiddenLayerSize]; order: [wi,wf,wo,wg]
                    final INDArray epsilon, final boolean truncatedBPTT, final int tbpttBackwardLength,
                    final FwdPassReturn fwdPass, final boolean forwards, final String inputWeightKey,

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

MathUtils has 82 methods (exceeds 20 allowed). Consider refactoring.
Open

public class MathUtils {



    /**
Severity: Major
Found in nd4j/nd4j-common/src/main/java/org/nd4j/common/util/MathUtils.java - About 1 day to fix

    File JcublasLapack.java has 680 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      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

                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
                    Severity
                    Category
                    Status
                    Source
                    Language