Showing 6,111 of 13,975 total issues
Method put
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public SDVariable put(SDVariable indices,SDVariable toPut,SDVariable putIndices) {
//start at 1 because we start with the initial output (basically the item at the first element in the indices)
SDVariable currIteration = sameDiff.var(Nd4j.zeros(1).castTo(DataType.INT32));
//this condition is normally used when you want to toss in an extra condition to terminate early
SDVariable cond = sameDiff.constant(true);
Method addControlDependency
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public void addControlDependency(SDVariable controlDependency){
Variable vThis = sameDiff.getVariables().get(getVarName());
Variable vCD = sameDiff.getVariables().get(controlDependency.name());
//If possible: add control dependency on ops
Method allocate
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
public INDArray allocate(boolean detached, LongShapeDescriptor descriptor) {
if (descriptor.isEmpty()) {
INDArray ret = Nd4j.create(descriptor);
if (detached) {
Method mergeFrom
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@java.lang.Override
public Builder mergeFrom(
org.nd4j.shade.protobuf.CodedInputStream input,
org.nd4j.shade.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
Method cleanPath
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static String cleanPath(String path) {
if (path == null) {
return null;
} else {
String pathToUse = replace(path, "\\", "/");
Method toString
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
public String toString(){
List<String> lines = new ArrayList<>();
if(formatType != null) {
lines.add("Format type: " + formatType);
Method applyToSequence
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
public List<List<List<Writable>>> applyToSequence(List<List<Writable>> sequence) {
int timeColumnIdx = inputSchema.getIndexOfColumn(this.timeColumn);
Method next
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
public List<List<Writable>> next(int num) {
List<File> files = new ArrayList<>(num);
List<List<ImageObject>> objects = new ArrayList<>(num);
Method setLongInTime
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static void setLongInTime(FieldVector fieldVector,int index,long value) {
if(fieldVector instanceof TimeStampMilliVector) {
TimeStampMilliVector timeStampMilliVector = (TimeStampMilliVector) fieldVector;
timeStampMilliVector.set(index,value);
}
Method genDocString
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected static String genDocString(Op op){
//Following roughly: https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html
StringBuilder sb = new StringBuilder();
sb.append("\"\"\"")
.append(op.getOpName())
Method runHelper
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void runHelper() {
while (!shutdown.get()) {
List<ToPost> list = new ArrayList<>();
Method initPretrained
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public <M extends Model> M initPretrained(PretrainedType pretrainedType) throws IOException {
String remoteUrl = pretrainedUrl(pretrainedType);
if (remoteUrl == null)
throw new UnsupportedOperationException(
"Pretrained " + pretrainedType + " weights are not available for this model.");
Method addLayers
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static ComputationGraphConfiguration.GraphBuilder addLayers(ComputationGraphConfiguration.GraphBuilder graphBuilder, int layerNumber, String input, int filterSize, int nIn, int nOut, int poolSize, int poolStride) {
graphBuilder
.addLayer("convolution2d_" + layerNumber,
new ConvolutionLayer.Builder(filterSize,filterSize)
.nIn(nIn)
Method appendOrDefault
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static void appendOrDefault(UpdateEncoder.PerParameterStatsEncoder.SummaryStatEncoder sse, String param,
StatsType statsType, SummaryType summaryType, Map<String, Double> map, double defaultValue) {
Double d = map.get(param);
if (d == null)
d = defaultValue;
Method appendHelperInformation
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static void appendHelperInformation(StringBuilder sb, Layer[] layers){
sb.append("\n----- Layer Helpers - Memory Use -----\n");
int helperCount = 0;
long helperWithMemCount = 0L;
Method writeMemoryCrashDump
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static void writeMemoryCrashDump(@NonNull Model net, @NonNull Throwable e){
if(!crashDumpsEnabled){
return;
}
Method next
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
public MultiDataSet next(int num) {
Preconditions.checkState(hasNext(), "No next element available");
List<Pair<List<String>, String>> tokensAndLabelList;
int mbSize = 0;
Method createDistribution
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static org.nd4j.linalg.api.rng.distribution.Distribution createDistribution(Distribution dist) {
if (dist == null)
return null;
if (dist instanceof NormalDistribution) {
NormalDistribution nd = (NormalDistribution) dist;
Method getFormatForLayer
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static CNN2DFormat getFormatForLayer(Layer layer) {
if(layer instanceof Convolution1DLayer) {
Convolution1DLayer convolution1DLayer = (Convolution1DLayer) layer;
return convolution1DLayer.getCnn2dDataFormat();
} else if(layer instanceof ConvolutionLayer) {
Method getOutputType
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
public InputType getOutputType(int layerIndex, InputType inputType) {
switch (inputType.getType()) {
case FF: