deeplearning4j/deeplearning4j

View on GitHub

Showing 6,111 of 13,975 total issues

Method setNameForFunctionFromDescriptors has a Cognitive Complexity of 85 (exceeds 20 allowed). Consider refactoring.
Open

fun setNameForFunctionFromDescriptors(argDescriptors: Collection<OpNamespace.ArgDescriptor>, func: DifferentialFunction) {
    val fields = ArrayList<Field>()
    fields.addAll(func.javaClass.declaredFields.toList())
    fields.addAll(func.javaClass.superclass.declaredFields.toList())
    fields.forEach { field ->

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 getOutputsHelperTensorArrayOps has 276 lines of code (exceeds 25 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

    Builder has 74 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.MapperDeclaration)
            org.nd4j.ir.MapperNamespace.MapperDeclarationOrBuilder {
          public static final org.nd4j.shade.protobuf.Descriptors.Descriptor

      FlatProperties has 74 methods (exceeds 20 allowed). Consider refactoring.
      Open

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

        Method convertAttributes has a Cognitive Complexity of 84 (exceeds 20 allowed). Consider refactoring.
        Open

            override fun convertAttributes(mappingCtx: MappingContext<GRAPH_DEF, NODE_TYPE, OP_DEF_TYPE, TENSOR_TYPE, ATTR_DEF, ATTR_VALUE_TYPE, DATA_TYPE>): List<OpNamespace.ArgDescriptor> {
                val ret = ArrayList<OpNamespace.ArgDescriptor>()
                for((k, v) in mappingNamesToPerform()) {
                    val descriptorForName = transformerArgs[k]
                    val compString = descriptorForName!![0].stringValue

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

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

          File BaseStatsListener.java has 614 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

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

            File ModelSerializer.java has 609 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

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

              File TransferLearning.java has 609 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

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

                Method doBackward has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
                Open

                    @Override
                    public Pair<Gradient, INDArray[]> doBackward(boolean tbptt, LayerWorkspaceMgr workspaceMgr) {
                        if (!canDoBackward())
                            throw new IllegalStateException("Cannot do backward pass: errors not set");
                
                

                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 a Cognitive Complexity of 67 (exceeds 5 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) {

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

                    public static SameDiff importGraph(@NonNull GraphDef tfGraph, Map<String, TFImportOverride> importOverride, TFOpImportFilter opFilter) {
                
                        /*
                        First, build an in-memory representation of the graph that allows us to build the graph incrementally
                        If we can build the graph incrementally, we can make sure that the added variables are set up with the correct

                  DynamicCustomOp has 71 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  @Slf4j
                  public class DynamicCustomOp extends DifferentialFunction implements CustomOp {
                  
                      private String opName;
                      @Builder.Default

                    UIVariable has 71 methods (exceeds 20 allowed). Consider refactoring.
                    Open

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

                      Method next has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
                      Open

                          @Override
                          public List<List<Writable>> next(int num) {
                              Preconditions.checkArgument(num > 0, "Number of examples must be > 0: got %s", num);
                      
                              if (imageLoader == 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 appendTo has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public StringBuilder appendTo(final StringBuilder builder) {
                              builder.append('{');
                              boolean atLeastOne = false;
                              if (score()) {
                                  if (atLeastOne) {

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

                          @Override
                          public Pair<Gradient, INDArray> backpropGradient(INDArray epsilon, LayerWorkspaceMgr workspaceMgr) {
                              assertInputSet(true);
                              INDArray nextEpsilon;
                              val shape = getShape(epsilon);

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

                          @Override
                          public void iterationDone(Model model, int iteration, int epoch) {
                              // we update lastTime on every iteration
                              // just to simplify things
                              if (lastTime.get() == 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 doEvaluationHelper has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private <T extends IEvaluation> Map<Integer,T[]> doEvaluationHelper(MultiDataSetIterator iterator, Map<Integer, T[]> evaluations){
                              if (layers == null || !(getOutputLayer(0) instanceof IOutputLayer)) {
                                  throw new IllegalStateException("Cannot evaluate network with no output layer");
                              }
                      
                      

                      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 TFGraphMapper.java has 594 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