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;
- Read upRead up
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 132 lines of code (exceeds 25 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;
File KerasModelUtils.java
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* ******************************************************************************
* *
* *
* * This program and the accompanying materials are made available under the
Method setDataFormatIfNeeded
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
public static void setDataFormatIfNeeded(InputPreProcessor inputPreProcessor, KerasLayer currLayer) {
if(inputPreProcessor instanceof ReshapePreprocessor) {
ReshapePreprocessor reshapePreprocessor = (ReshapePreprocessor) inputPreProcessor;
if(currLayer.isLayer()) {
if(currLayer.getDimOrder() != null) {
- Read upRead up
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
Avoid deeply nested control flow statements. Open
if(convolutionLayer instanceof Convolution3D) {
Convolution3D convolution3D = (Convolution3D) convolutionLayer;
reshapePreprocessor.setFormat(convolution3D.getDataFormat());
} else if(convolutionLayer instanceof Deconvolution3D) {
Deconvolution3D deconvolution3D = (Deconvolution3D) convolutionLayer;
Method importWeights
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static void importWeights(Hdf5Archive weightsArchive, String weightsRoot, Map<String, KerasLayer> layers,
int kerasVersion, String backend)
Method copyWeightsToModel
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static Model copyWeightsToModel(Model model, Map<String, KerasLayer> kerasLayers)
throws InvalidKerasConfigurationException {
/* Get list if layers from model. */
org.deeplearning4j.nn.api.Layer[] layersFromModel;
if (model instanceof MultiLayerNetwork)
- Read upRead up
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"