Showing 6,111 of 13,975 total issues
Method collectCoverageInformation
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static void collectCoverageInformation(TestCase testCase) {
SameDiff sd = testCase.sameDiff();
//NOTE: Count on a per-test-case basis, not on a 'per function seen' basis
//i.e., don't double count if a SameDiff instance has multiple copies of the same op type
Method mergeFrom
has 32 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 toArrayAndByteBuffer
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected static Pair<INDArray, ByteBuffer> toArrayAndByteBuffer(ByteBuffer buffer, int offset) {
ByteBuffer byteBuffer = buffer.hasArray() ? ByteBuffer.allocateDirect(buffer.array().length).put(buffer.array())
.order(ByteOrder.nativeOrder()) : buffer.order(ByteOrder.nativeOrder());
//bump the byte buffer to the proper position
byteBuffer.position(offset);
Method initSessionAndStatusIfNeeded
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void initSessionAndStatusIfNeeded(org.tensorflow.framework.GraphDef graphDef1) {
//infer the inputs and outputSchema for the graph
Set<String> seenAsInput = new LinkedHashSet<>();
for(int i = 0; i < graphDef1.getNodeCount(); i++) {
NodeDef node = graphDef1.getNode(i);
Method exists
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
public boolean exists() {
try {
URL ex = this.getURL();
if (ResourceUtils.isFileURL(ex)) {
Method mapSequence
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
public List<List<Writable>> mapSequence(List<List<Writable>> sequence) {
int nCols = inputSchema.numColumns();
List<List<Writable>> out = new ArrayList<>();
Method apply
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
public StringQuality apply(StringQuality v1, Writable writable) {
long valid = v1.getCountValid();
long invalid = v1.getCountInvalid();
long countMissing = v1.getCountMissing();
Method map
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
public List<Writable> map(List<Writable> writables) {
if (writables.size() != inputSchema.numColumns()) {
throw new IllegalStateException("Cannot execute transform: input writables list length (" + writables.size()
+ ") does not " + "match expected number of elements (schema: " + inputSchema.numColumns()
Method transformRawStringsToInputList
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public List<Writable> transformRawStringsToInputList(List<String> values) {
List<Writable> ret = new ArrayList<>();
if (values.size() != initialSchema.numColumns())
throw new IllegalArgumentException(
String.format("Number of values %d does not match the number of input columns %d for schema",
Method normalizeCifar
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public void normalizeCifar(File fileName) {
DataSet result = new DataSet();
result.load(fileName);
if (!meanStdStored && train) {
uMean = Math.abs(uMean / numExamples);
Method load
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected void load() {
if (!cifarRawFilesExist() && !fullDir.exists()) {
fullDir.mkdir();
log.info("Downloading CIFAR data set");
Method reduceStringOrCategoricalColumn
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static IAggregableReduceOp<Writable, List<Writable>> reduceStringOrCategoricalColumn(List<ReduceOp> lop,
boolean ignoreInvalid, ColumnMetaData metaData) {
List<IAggregableReduceOp<String, Writable>> res = new ArrayList<>(lop.size());
for (int i = 0; i < lop.size(); i++) {
Method metaDataFromField
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private static ColumnMetaData metaDataFromField(Field field) {
ArrowType arrowType = field.getFieldType().getType();
if(arrowType instanceof ArrowType.Int) {
val intType = (ArrowType.Int) arrowType;
if(intType.getBitWidth() == 32)
Method loadConfigGuess
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static Object loadConfigGuess(String path) throws Exception {
String input = FileUtils.readFileToString(new File(path));
//note here that we load json BEFORE YAML. YAML
//turns out to load just fine *accidentally*
try {
Method entrySize
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private int entrySize(List<String> entryNames, StatsType... statsTypes) {
int bufferSize = 0;
for (String s : entryNames) {
//For each parameter: MAY also have a number of summary stats (mean, stdev etc), and histograms (both as nested groups)
int summaryStatsCount = 0;
Method initializeTables
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private void initializeTables() throws SQLException {
//Need tables for:
//(a) Metadata -> session ID and type ID; class; StorageMetaData as a binary BLOB
//(b) Static info -> session ID, type ID, worker ID, persistable class, persistable bytes
Method wordsNearestSum
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
@Override
public Collection<String> wordsNearestSum(INDArray words, int top) {
if (lookupTable instanceof InMemoryLookupTable) {
InMemoryLookupTable l = (InMemoryLookupTable) lookupTable;
Method readWord2VecModel
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static Word2Vec readWord2VecModel(File file, boolean extendedModel) {
if (!file.exists() || !file.isFile()) {
throw new ND4JIllegalStateException("File [" + file.getAbsolutePath() + "] doesn't exist");
}
Method fromCached
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
private DataSet fromCached(int num) {
if (cachedWindow.isEmpty()) {
while (cachedWindow.size() < num && iter.hasNext()) {
String sentence = iter.nextSentence();
if (sentence.isEmpty())
Method writeSequenceVectors
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public static <T extends SequenceElement> void writeSequenceVectors(@NonNull SequenceVectors<T> vectors,
@NonNull OutputStream stream)
throws IOException {
InMemoryLookupTable<VocabWord> lookupTable = (InMemoryLookupTable<VocabWord>) vectors.getLookupTable();