deeplearning4j/deeplearning4j

View on GitHub

Showing 6,111 of 13,975 total issues

Method getOutputsHelperTensorArrayOps has a Cognitive Complexity of 158 (exceeds 5 allowed). Consider refactoring.
Open

    public ExecutionResult getOutputsHelperTensorArrayOps(DifferentialFunction op, FrameIter outputFrameIter, Set<VarId> opInputs, Set<VarId> allIterInputs, Map<String, SDValue> otherPlaceHolders) {
        /*
        TODO: TensorArray memory management note: For now, we'll close any INDArrays stored in the TensorArray at the end of
        graph execution. This uses more memory than necessary for an earlier close strategy, but simplifies memory management.
        This should be revisited and optimized later

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

FlatNode has 160 methods (exceeds 20 allowed). Consider refactoring.
Open

@SuppressWarnings("unused")
public final class FlatNode extends Table {
  public static void ValidateVersion() { Constants.FLATBUFFERS_1_12_0(); }
  public static FlatNode getRootAsFlatNode(ByteBuffer _bb) { return getRootAsFlatNode(_bb, new FlatNode()); }
  public static FlatNode getRootAsFlatNode(ByteBuffer _bb, FlatNode obj) { _bb.order(ByteOrder.LITTLE_ENDIAN); return (obj.__assign(_bb.getInt(_bb.position()) + _bb.position(), _bb)); }

    SDVariable has 157 methods (exceeds 20 allowed). Consider refactoring.
    Open

    @Data
    @NoArgsConstructor
    @Slf4j
    public class SDVariable implements Serializable {
    
    

      Method getOutputs has a Cognitive Complexity of 152 (exceeds 5 allowed). Consider refactoring.
      Open

          @Override
          public ExecutionResult getOutputs(Pair<SameDiffOp, OpContext> opPair,
                                            FrameIter outputFrameIter,
                                            Set<VarId> opInputs,
                                            Set<VarId> allIterInputs,

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

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

        Method fitHelper has a Cognitive Complexity of 148 (exceeds 5 allowed). Consider refactoring.
        Open

            protected synchronized History fitHelper(@NonNull MultiDataSetIterator iter, int numEpochs, boolean incrementEpochCount,
                                                     MultiDataSetIterator validationData, int validationFrequency, @NonNull List<Listener> listeners) {
                Preconditions.checkNotNull(iter, "Iterator must not be null");
                Preconditions.checkState(numEpochs > 0, "Number of training epochs must be a positive number. Got: %s", numEpochs);
                Preconditions.checkState(trainingConfig != null, "No training configuration has been set. A training configuration must " +

        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

        StaticInfoEncoder has 152 methods (exceeds 20 allowed). Consider refactoring.
        Open

        @javax.annotation.Generated(value = {"org.deeplearning4j.ui.stats.sbe.StaticInfoEncoder"})
        @SuppressWarnings("all")
        public class StaticInfoEncoder {
            public static final int BLOCK_LENGTH = 40;
            public static final int TEMPLATE_ID = 1;

          File Evaluation.java has 1132 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

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

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

                protected EarlyStoppingResult<T> fit(boolean pretrain) {
                    esConfig.validate();
                    log.info("Starting early stopping training");
                    if (esConfig.getScoreCalculator() == null)
                        log.warn("No score calculator provided for early stopping. Score will be reported as 0.0 to epoch termination conditions");

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

                @Override
                public void encode(MutableDirectBuffer buffer) {
                    MessageHeaderEncoder enc = new MessageHeaderEncoder();
                    UpdateEncoder ue = new UpdateEncoder();
            
            

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

                public static void importWeights(Hdf5Archive weightsArchive, String weightsRoot, Map<String, KerasLayer> layers,
                                                 int kerasVersion, String backend)
                        throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException {
                    // check to ensure naming scheme doesn't include forward slash
                    boolean includesSlash = false;

            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

            Builder has 141 methods (exceeds 20 allowed). Consider refactoring.
            Open

                public static final class Builder extends
                    org.nd4j.shade.protobuf.GeneratedMessageV3.Builder<Builder> implements
                    // @@protoc_insertion_point(builder_implements:org.nd4j.ir.TensorProto)
                    org.nd4j.ir.TensorNamespace.TensorProtoOrBuilder {
                  public static final org.nd4j.shade.protobuf.Descriptors.Descriptor

              Method getOverviewDataForSession has a Cognitive Complexity of 130 (exceeds 5 allowed). Consider refactoring.
              Open

                  private synchronized void getOverviewDataForSession(String sessionId, RoutingContext rc) {
                      Long lastUpdateTime = getLastUpdateTime(sessionId);
                      I18N i18N = getI18N(sessionId);
              
                      //First pass (optimize later): query all data...

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

                  /**
                   * Import a Graph based on a {@link IRGraph} model from a GraphDef, with optional import overrides
                   *
                   * @param irGraph       IRGraph reflecting the needed model import
                   * @param importOverride Optional import override for specific ops, keyed by op name

                CudaDataBufferFactory has 133 methods (exceeds 20 allowed). Consider refactoring.
                Open

                @Slf4j
                public class CudaDataBufferFactory implements DataBufferFactory {
                    protected DataBuffer.AllocationMode allocationMode;
                
                    @Override

                  DefaultDataBufferFactory has 131 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  public class DefaultDataBufferFactory implements DataBufferFactory {
                      protected DataBuffer.AllocationMode allocationMode;
                  
                  
                      @Override

                    DataBufferFactory has 131 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    public interface DataBufferFactory {
                    
                        /**
                         * Setter for the allocation mode
                         * @param allocationMode

                      Method fillNDArray has a Cognitive Complexity of 126 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected void fillNDArray(Mat image, INDArray ret) {
                              long rows = image.rows();
                              long cols = image.cols();
                              long channels = image.channels();
                      
                      

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

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

                        BaseDataBuffer has 129 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        @Slf4j
                        public abstract class BaseDataBuffer implements DataBuffer {
                        
                            /**
                             * @deprecated Use {@link ND4JSystemProperties#DATABUFFER_TO_STRING_MAX_ELEMENTS}
                          Severity
                          Category
                          Status
                          Source
                          Language