id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
128,000 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/VocabularyHolder.java | VocabularyHolder.incrementWordCounter | public void incrementWordCounter(String word) {
if (vocabulary.containsKey(word)) {
vocabulary.get(word).incrementCount();
}
// there's no need to throw such exception here. just do nothing if word is not found
//else throw new IllegalStateException("No such word found");
... | java | public void incrementWordCounter(String word) {
if (vocabulary.containsKey(word)) {
vocabulary.get(word).incrementCount();
}
// there's no need to throw such exception here. just do nothing if word is not found
//else throw new IllegalStateException("No such word found");
... | [
"public",
"void",
"incrementWordCounter",
"(",
"String",
"word",
")",
"{",
"if",
"(",
"vocabulary",
".",
"containsKey",
"(",
"word",
")",
")",
"{",
"vocabulary",
".",
"get",
"(",
"word",
")",
".",
"incrementCount",
"(",
")",
";",
"}",
"// there's no need t... | Increments by one number of occurrences of the word in corpus
@param word whose counter is to be incremented | [
"Increments",
"by",
"one",
"number",
"of",
"occurrences",
"of",
"the",
"word",
"in",
"corpus"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/VocabularyHolder.java#L253-L259 |
128,001 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/VocabularyHolder.java | VocabularyHolder.activateScavenger | protected synchronized void activateScavenger() {
int initialSize = vocabulary.size();
List<VocabularyWord> words = new ArrayList<>(vocabulary.values());
for (VocabularyWord word : words) {
// scavenging could be applied only to non-special tokens that are below minWordFrequency
... | java | protected synchronized void activateScavenger() {
int initialSize = vocabulary.size();
List<VocabularyWord> words = new ArrayList<>(vocabulary.values());
for (VocabularyWord word : words) {
// scavenging could be applied only to non-special tokens that are below minWordFrequency
... | [
"protected",
"synchronized",
"void",
"activateScavenger",
"(",
")",
"{",
"int",
"initialSize",
"=",
"vocabulary",
".",
"size",
"(",
")",
";",
"List",
"<",
"VocabularyWord",
">",
"words",
"=",
"new",
"ArrayList",
"<>",
"(",
"vocabulary",
".",
"values",
"(",
... | This method removes low-frequency words based on their frequency change between activations.
I.e. if word has appeared only once, and it's retained the same frequency over consequence activations, we can assume it can be removed freely | [
"This",
"method",
"removes",
"low",
"-",
"frequency",
"words",
"based",
"on",
"their",
"frequency",
"change",
"between",
"activations",
".",
"I",
".",
"e",
".",
"if",
"word",
"has",
"appeared",
"only",
"once",
"and",
"it",
"s",
"retained",
"the",
"same",
... | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/VocabularyHolder.java#L312-L355 |
128,002 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/VocabularyHolder.java | VocabularyHolder.resetWordCounters | public void resetWordCounters() {
for (VocabularyWord word : getVocabulary()) {
word.setHuffmanNode(null);
word.setFrequencyShift(null);
word.setCount(0);
}
} | java | public void resetWordCounters() {
for (VocabularyWord word : getVocabulary()) {
word.setHuffmanNode(null);
word.setFrequencyShift(null);
word.setCount(0);
}
} | [
"public",
"void",
"resetWordCounters",
"(",
")",
"{",
"for",
"(",
"VocabularyWord",
"word",
":",
"getVocabulary",
"(",
")",
")",
"{",
"word",
".",
"setHuffmanNode",
"(",
"null",
")",
";",
"word",
".",
"setFrequencyShift",
"(",
"null",
")",
";",
"word",
"... | This methods reset counters for all words in vocabulary | [
"This",
"methods",
"reset",
"counters",
"for",
"all",
"words",
"in",
"vocabulary"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/VocabularyHolder.java#L360-L366 |
128,003 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/VocabularyHolder.java | VocabularyHolder.truncateVocabulary | public void truncateVocabulary(int threshold) {
logger.debug("Truncating vocabulary to minWordFrequency: [" + threshold + "]");
Set<String> keyset = vocabulary.keySet();
for (String word : keyset) {
VocabularyWord vw = vocabulary.get(word);
// please note: we're not appl... | java | public void truncateVocabulary(int threshold) {
logger.debug("Truncating vocabulary to minWordFrequency: [" + threshold + "]");
Set<String> keyset = vocabulary.keySet();
for (String word : keyset) {
VocabularyWord vw = vocabulary.get(word);
// please note: we're not appl... | [
"public",
"void",
"truncateVocabulary",
"(",
"int",
"threshold",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Truncating vocabulary to minWordFrequency: [\"",
"+",
"threshold",
"+",
"\"]\"",
")",
";",
"Set",
"<",
"String",
">",
"keyset",
"=",
"vocabulary",
".",
"ke... | All words with frequency below threshold wii be removed
@param threshold exclusive threshold for removal | [
"All",
"words",
"with",
"frequency",
"below",
"threshold",
"wii",
"be",
"removed"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/VocabularyHolder.java#L388-L401 |
128,004 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/VocabularyHolder.java | VocabularyHolder.indexOf | public int indexOf(String word) {
if (vocabulary.containsKey(word)) {
return vocabulary.get(word).getHuffmanNode().getIdx();
} else
return -1;
} | java | public int indexOf(String word) {
if (vocabulary.containsKey(word)) {
return vocabulary.get(word).getHuffmanNode().getIdx();
} else
return -1;
} | [
"public",
"int",
"indexOf",
"(",
"String",
"word",
")",
"{",
"if",
"(",
"vocabulary",
".",
"containsKey",
"(",
"word",
")",
")",
"{",
"return",
"vocabulary",
".",
"get",
"(",
"word",
")",
".",
"getHuffmanNode",
"(",
")",
".",
"getIdx",
"(",
")",
";",... | This method returns index of word in sorted list.
@param word
@return | [
"This",
"method",
"returns",
"index",
"of",
"word",
"in",
"sorted",
"list",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/VocabularyHolder.java#L499-L504 |
128,005 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/VocabularyHolder.java | VocabularyHolder.words | public List<VocabularyWord> words() {
List<VocabularyWord> vocab = new ArrayList<>(vocabulary.values());
Collections.sort(vocab, new Comparator<VocabularyWord>() {
@Override
public int compare(VocabularyWord o1, VocabularyWord o2) {
return Integer.compare(o2.getCo... | java | public List<VocabularyWord> words() {
List<VocabularyWord> vocab = new ArrayList<>(vocabulary.values());
Collections.sort(vocab, new Comparator<VocabularyWord>() {
@Override
public int compare(VocabularyWord o1, VocabularyWord o2) {
return Integer.compare(o2.getCo... | [
"public",
"List",
"<",
"VocabularyWord",
">",
"words",
"(",
")",
"{",
"List",
"<",
"VocabularyWord",
">",
"vocab",
"=",
"new",
"ArrayList",
"<>",
"(",
"vocabulary",
".",
"values",
"(",
")",
")",
";",
"Collections",
".",
"sort",
"(",
"vocab",
",",
"new"... | Returns sorted list of words in vocabulary.
Sort is DESCENDING.
@return list of VocabularyWord | [
"Returns",
"sorted",
"list",
"of",
"words",
"in",
"vocabulary",
".",
"Sort",
"is",
"DESCENDING",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/VocabularyHolder.java#L513-L523 |
128,006 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/solvers/accumulation/EncodingHandler.java | EncodingHandler.getAverageThresholdAlgorithm | public ThresholdAlgorithm getAverageThresholdAlgorithm(){
Collection<ThresholdAlgorithm> c = this.allThreadThresholdAlgorithms.values();
if(c.isEmpty()){
return null;
}
if(c.size() == 1){
return c.iterator().next();
}
Iterator<ThresholdAlgorithm> i... | java | public ThresholdAlgorithm getAverageThresholdAlgorithm(){
Collection<ThresholdAlgorithm> c = this.allThreadThresholdAlgorithms.values();
if(c.isEmpty()){
return null;
}
if(c.size() == 1){
return c.iterator().next();
}
Iterator<ThresholdAlgorithm> i... | [
"public",
"ThresholdAlgorithm",
"getAverageThresholdAlgorithm",
"(",
")",
"{",
"Collection",
"<",
"ThresholdAlgorithm",
">",
"c",
"=",
"this",
".",
"allThreadThresholdAlgorithms",
".",
"values",
"(",
")",
";",
"if",
"(",
"c",
".",
"isEmpty",
"(",
")",
")",
"{"... | This should ONLY be called once all training threads have completed
@return | [
"This",
"should",
"ONLY",
"be",
"called",
"once",
"all",
"training",
"threads",
"have",
"completed"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/solvers/accumulation/EncodingHandler.java#L347-L371 |
128,007 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/CapsuleUtils.java | CapsuleUtils.softmax | public static SDVariable softmax(SameDiff SD, SDVariable x, int dimension, int rank){
int[] permutation = ArrayUtil.range(0, rank);
permutation[0] = dimension;
permutation[dimension] = 0;
return SD.nn.softmax(x.permute(permutation)).permute(ArrayUtil.invertPermutation(permutation));
... | java | public static SDVariable softmax(SameDiff SD, SDVariable x, int dimension, int rank){
int[] permutation = ArrayUtil.range(0, rank);
permutation[0] = dimension;
permutation[dimension] = 0;
return SD.nn.softmax(x.permute(permutation)).permute(ArrayUtil.invertPermutation(permutation));
... | [
"public",
"static",
"SDVariable",
"softmax",
"(",
"SameDiff",
"SD",
",",
"SDVariable",
"x",
",",
"int",
"dimension",
",",
"int",
"rank",
")",
"{",
"int",
"[",
"]",
"permutation",
"=",
"ArrayUtil",
".",
"range",
"(",
"0",
",",
"rank",
")",
";",
"permuta... | Compute softmax along a given dimension | [
"Compute",
"softmax",
"along",
"a",
"given",
"dimension"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/CapsuleUtils.java#L51-L57 |
128,008 | deeplearning4j/deeplearning4j | rl4j/rl4j-core/src/main/java/org/deeplearning4j/rl4j/util/DataManager.java | DataManager.createSubdir | public String createSubdir() throws IOException {
if (!saveData)
return "";
File dr = new File(dataRoot);
dr.mkdirs();
File[] rootChildren = dr.listFiles();
int i = 1;
while (childrenExist(rootChildren, i + ""))
i++;
File f = new File(d... | java | public String createSubdir() throws IOException {
if (!saveData)
return "";
File dr = new File(dataRoot);
dr.mkdirs();
File[] rootChildren = dr.listFiles();
int i = 1;
while (childrenExist(rootChildren, i + ""))
i++;
File f = new File(d... | [
"public",
"String",
"createSubdir",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"saveData",
")",
"return",
"\"\"",
";",
"File",
"dr",
"=",
"new",
"File",
"(",
"dataRoot",
")",
";",
"dr",
".",
"mkdirs",
"(",
")",
";",
"File",
"[",
"]",
"... | FIXME race condition if you create them at the same time where checking if dir exists is not atomic with the creation | [
"FIXME",
"race",
"condition",
"if",
"you",
"create",
"them",
"at",
"the",
"same",
"time",
"where",
"checking",
"if",
"dir",
"exists",
"is",
"not",
"atomic",
"with",
"the",
"creation"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/rl4j/rl4j-core/src/main/java/org/deeplearning4j/rl4j/util/DataManager.java#L171-L201 |
128,009 | deeplearning4j/deeplearning4j | datavec/datavec-hadoop/src/main/java/org/datavec/hadoop/records/reader/mapfile/MapFileReader.java | MapFileReader.getRecord | public V getRecord(long index) throws IOException {
//First: determine which reader to read from...
int readerIdx = -1;
for (int i = 0; i < recordIndexesEachReader.size(); i++) {
Pair<Long, Long> p = recordIndexesEachReader.get(i);
if (index >= p.getFirst() && index <= p.... | java | public V getRecord(long index) throws IOException {
//First: determine which reader to read from...
int readerIdx = -1;
for (int i = 0; i < recordIndexesEachReader.size(); i++) {
Pair<Long, Long> p = recordIndexesEachReader.get(i);
if (index >= p.getFirst() && index <= p.... | [
"public",
"V",
"getRecord",
"(",
"long",
"index",
")",
"throws",
"IOException",
"{",
"//First: determine which reader to read from...",
"int",
"readerIdx",
"=",
"-",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"recordIndexesEachReader",
".",
"si... | It a single record from the map file for the given index
@param index Index, between 0 and numRecords()-1
@return Value from the MapFile
@throws IOException If an error occurs during reading | [
"It",
"a",
"single",
"record",
"from",
"the",
"map",
"file",
"for",
"the",
"given",
"index"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-hadoop/src/main/java/org/datavec/hadoop/records/reader/mapfile/MapFileReader.java#L110-L129 |
128,010 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/ops/NativeOpExecutioner.java | NativeOpExecutioner.exec | @Override
public INDArray exec(RandomOp op, Random rng) {
if (!(rng instanceof CpuNativeRandom))
throw new IllegalStateException(
"You should use one of NativeRandom classes for NativeOperations execution. Op class: " + op.getClass().getName());
long st = profilingCo... | java | @Override
public INDArray exec(RandomOp op, Random rng) {
if (!(rng instanceof CpuNativeRandom))
throw new IllegalStateException(
"You should use one of NativeRandom classes for NativeOperations execution. Op class: " + op.getClass().getName());
long st = profilingCo... | [
"@",
"Override",
"public",
"INDArray",
"exec",
"(",
"RandomOp",
"op",
",",
"Random",
"rng",
")",
"{",
"if",
"(",
"!",
"(",
"rng",
"instanceof",
"CpuNativeRandom",
")",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"You should use one of NativeRandom classes... | This method executes specific
RandomOp against specified RNG
@param op
@param rng | [
"This",
"method",
"executes",
"specific",
"RandomOp",
"against",
"specified",
"RNG"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-native/src/main/java/org/nd4j/linalg/cpu/nativecpu/ops/NativeOpExecutioner.java#L1203-L1244 |
128,011 | deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/messages/intercom/DistributedInitializationMessage.java | DistributedInitializationMessage.processMessage | @Override
public void processMessage() {
// protection check, we definitely don't want double spending here
INDArray syn0 = storage.getArray(WordVectorStorage.SYN_0);
INDArray syn1 = storage.getArray(WordVectorStorage.SYN_1);
INDArray syn1Neg = storage.getArray(WordVectorStorage.SYN_... | java | @Override
public void processMessage() {
// protection check, we definitely don't want double spending here
INDArray syn0 = storage.getArray(WordVectorStorage.SYN_0);
INDArray syn1 = storage.getArray(WordVectorStorage.SYN_1);
INDArray syn1Neg = storage.getArray(WordVectorStorage.SYN_... | [
"@",
"Override",
"public",
"void",
"processMessage",
"(",
")",
"{",
"// protection check, we definitely don't want double spending here",
"INDArray",
"syn0",
"=",
"storage",
".",
"getArray",
"(",
"WordVectorStorage",
".",
"SYN_0",
")",
";",
"INDArray",
"syn1",
"=",
"s... | This method initializes shard storage with given data | [
"This",
"method",
"initializes",
"shard",
"storage",
"with",
"given",
"data"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/messages/intercom/DistributedInitializationMessage.java#L63-L119 |
128,012 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/LongShapeDescriptor.java | LongShapeDescriptor.asDataType | public LongShapeDescriptor asDataType(DataType dataType){
long extras = 0L;
extras = ArrayOptionsHelper.setOptionBit(extras, dataType);
if(isEmpty()){
extras = ArrayOptionsHelper.setOptionBit(extras, ArrayType.EMPTY);
}
return new LongShapeDescriptor(shape, stride, of... | java | public LongShapeDescriptor asDataType(DataType dataType){
long extras = 0L;
extras = ArrayOptionsHelper.setOptionBit(extras, dataType);
if(isEmpty()){
extras = ArrayOptionsHelper.setOptionBit(extras, ArrayType.EMPTY);
}
return new LongShapeDescriptor(shape, stride, of... | [
"public",
"LongShapeDescriptor",
"asDataType",
"(",
"DataType",
"dataType",
")",
"{",
"long",
"extras",
"=",
"0L",
";",
"extras",
"=",
"ArrayOptionsHelper",
".",
"setOptionBit",
"(",
"extras",
",",
"dataType",
")",
";",
"if",
"(",
"isEmpty",
"(",
")",
")",
... | Return a new LongShapeDescriptor with the same shape, strides, order etc but with the specified datatype instead
@param dataType Datatype of the returned descriptor | [
"Return",
"a",
"new",
"LongShapeDescriptor",
"with",
"the",
"same",
"shape",
"strides",
"order",
"etc",
"but",
"with",
"the",
"specified",
"datatype",
"instead"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/LongShapeDescriptor.java#L164-L171 |
128,013 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/inmemory/AbstractCache.java | AbstractCache.incrementWordCount | @Override
public void incrementWordCount(String word, int increment) {
T element = extendedVocabulary.get(word);
if (element != null) {
element.increaseElementFrequency(increment);
totalWordCount.addAndGet(increment);
}
} | java | @Override
public void incrementWordCount(String word, int increment) {
T element = extendedVocabulary.get(word);
if (element != null) {
element.increaseElementFrequency(increment);
totalWordCount.addAndGet(increment);
}
} | [
"@",
"Override",
"public",
"void",
"incrementWordCount",
"(",
"String",
"word",
",",
"int",
"increment",
")",
"{",
"T",
"element",
"=",
"extendedVocabulary",
".",
"get",
"(",
"word",
")",
";",
"if",
"(",
"element",
"!=",
"null",
")",
"{",
"element",
".",... | Increment frequency for specified label by specified value
@param word the word to increment the count for
@param increment the amount to increment by | [
"Increment",
"frequency",
"for",
"specified",
"label",
"by",
"specified",
"value"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/inmemory/AbstractCache.java#L143-L150 |
128,014 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/inmemory/AbstractCache.java | AbstractCache.wordAtIndex | @Override
public String wordAtIndex(int index) {
T element = idxMap.get(index);
if (element != null) {
return element.getLabel();
}
return null;
} | java | @Override
public String wordAtIndex(int index) {
T element = idxMap.get(index);
if (element != null) {
return element.getLabel();
}
return null;
} | [
"@",
"Override",
"public",
"String",
"wordAtIndex",
"(",
"int",
"index",
")",
"{",
"T",
"element",
"=",
"idxMap",
".",
"get",
"(",
"index",
")",
";",
"if",
"(",
"element",
"!=",
"null",
")",
"{",
"return",
"element",
".",
"getLabel",
"(",
")",
";",
... | Returns the label of the element at specified Huffman index
@param index the index of the word to get
@return | [
"Returns",
"the",
"label",
"of",
"the",
"element",
"at",
"specified",
"Huffman",
"index"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/inmemory/AbstractCache.java#L195-L202 |
128,015 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/inmemory/AbstractCache.java | AbstractCache.indexOf | @Override
public int indexOf(String label) {
T token = tokenFor(label);
if (token != null) {
return token.getIndex();
} else
return -2;
} | java | @Override
public int indexOf(String label) {
T token = tokenFor(label);
if (token != null) {
return token.getIndex();
} else
return -2;
} | [
"@",
"Override",
"public",
"int",
"indexOf",
"(",
"String",
"label",
")",
"{",
"T",
"token",
"=",
"tokenFor",
"(",
"label",
")",
";",
"if",
"(",
"token",
"!=",
"null",
")",
"{",
"return",
"token",
".",
"getIndex",
"(",
")",
";",
"}",
"else",
"retur... | Returns Huffman index for specified label
@param label the label to get index for
@return >=0 if label exists, -1 if Huffman tree wasn't built yet, -2 if specified label wasn't found | [
"Returns",
"Huffman",
"index",
"for",
"specified",
"label"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/inmemory/AbstractCache.java#L221-L228 |
128,016 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/inmemory/AbstractCache.java | AbstractCache.incrementDocCount | @Override
public void incrementDocCount(String word, long howMuch) {
T element = extendedVocabulary.get(word);
if (element != null) {
element.incrementSequencesCount();
}
} | java | @Override
public void incrementDocCount(String word, long howMuch) {
T element = extendedVocabulary.get(word);
if (element != null) {
element.incrementSequencesCount();
}
} | [
"@",
"Override",
"public",
"void",
"incrementDocCount",
"(",
"String",
"word",
",",
"long",
"howMuch",
")",
"{",
"T",
"element",
"=",
"extendedVocabulary",
".",
"get",
"(",
"word",
")",
";",
"if",
"(",
"element",
"!=",
"null",
")",
"{",
"element",
".",
... | Increment number of documents the label was observed in
Please note: this method is NOT thread-safe
@param word the word to increment by
@param howMuch | [
"Increment",
"number",
"of",
"documents",
"the",
"label",
"was",
"observed",
"in"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/inmemory/AbstractCache.java#L334-L340 |
128,017 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/inmemory/AbstractCache.java | AbstractCache.setCountForDoc | @Override
public void setCountForDoc(String word, long count) {
T element = extendedVocabulary.get(word);
if (element != null) {
element.setSequencesCount(count);
}
} | java | @Override
public void setCountForDoc(String word, long count) {
T element = extendedVocabulary.get(word);
if (element != null) {
element.setSequencesCount(count);
}
} | [
"@",
"Override",
"public",
"void",
"setCountForDoc",
"(",
"String",
"word",
",",
"long",
"count",
")",
"{",
"T",
"element",
"=",
"extendedVocabulary",
".",
"get",
"(",
"word",
")",
";",
"if",
"(",
"element",
"!=",
"null",
")",
"{",
"element",
".",
"set... | Set exact number of observed documents that contain specified word
Please note: this method is NOT thread-safe
@param word the word to set the count for
@param count the count of the word | [
"Set",
"exact",
"number",
"of",
"observed",
"documents",
"that",
"contain",
"specified",
"word"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/inmemory/AbstractCache.java#L350-L356 |
128,018 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/inmemory/AbstractCache.java | AbstractCache.addToken | @Override
public boolean addToken(T element) {
boolean ret = false;
T oldElement = vocabulary.putIfAbsent(element.getStorageId(), element);
if (oldElement == null) {
//putIfAbsent added our element
if (element.getLabel() != null) {
extendedVocabulary.p... | java | @Override
public boolean addToken(T element) {
boolean ret = false;
T oldElement = vocabulary.putIfAbsent(element.getStorageId(), element);
if (oldElement == null) {
//putIfAbsent added our element
if (element.getLabel() != null) {
extendedVocabulary.p... | [
"@",
"Override",
"public",
"boolean",
"addToken",
"(",
"T",
"element",
")",
"{",
"boolean",
"ret",
"=",
"false",
";",
"T",
"oldElement",
"=",
"vocabulary",
".",
"putIfAbsent",
"(",
"element",
".",
"getStorageId",
"(",
")",
",",
"element",
")",
";",
"if",... | This method adds specified SequenceElement to vocabulary
@param element the word to add | [
"This",
"method",
"adds",
"specified",
"SequenceElement",
"to",
"vocabulary"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/inmemory/AbstractCache.java#L409-L426 |
128,019 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/BaseShapeInfoProvider.java | BaseShapeInfoProvider.createShapeInformation | @Override
public Pair<DataBuffer, long[]> createShapeInformation(long[] shape, DataType dataType) {
char order = Nd4j.order();
return createShapeInformation(shape, order, dataType);
} | java | @Override
public Pair<DataBuffer, long[]> createShapeInformation(long[] shape, DataType dataType) {
char order = Nd4j.order();
return createShapeInformation(shape, order, dataType);
} | [
"@",
"Override",
"public",
"Pair",
"<",
"DataBuffer",
",",
"long",
"[",
"]",
">",
"createShapeInformation",
"(",
"long",
"[",
"]",
"shape",
",",
"DataType",
"dataType",
")",
"{",
"char",
"order",
"=",
"Nd4j",
".",
"order",
"(",
")",
";",
"return",
"cre... | This method creates shapeInformation buffer, based on shape being passed in
@param shape
@return | [
"This",
"method",
"creates",
"shapeInformation",
"buffer",
"based",
"on",
"shape",
"being",
"passed",
"in"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/ndarray/BaseShapeInfoProvider.java#L43-L48 |
128,020 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/org/deeplearning4j/text/tokenization/tokenizerfactory/JapaneseTokenizerFactory.java | JapaneseTokenizerFactory.create | @Override
public Tokenizer create(String toTokenize) {
if (toTokenize.isEmpty()) {
throw new IllegalArgumentException("Unable to proceed; no sentence to tokenize");
}
Tokenizer t = new JapaneseTokenizer(kuromoji, toTokenize, useBaseForm);
if (preProcessor != null) {
... | java | @Override
public Tokenizer create(String toTokenize) {
if (toTokenize.isEmpty()) {
throw new IllegalArgumentException("Unable to proceed; no sentence to tokenize");
}
Tokenizer t = new JapaneseTokenizer(kuromoji, toTokenize, useBaseForm);
if (preProcessor != null) {
... | [
"@",
"Override",
"public",
"Tokenizer",
"create",
"(",
"String",
"toTokenize",
")",
"{",
"if",
"(",
"toTokenize",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unable to proceed; no sentence to tokenize\"",
")",
";",
"}",
... | Create a Tokenizer instance for the given sentence.
Note: This method is thread-safe.
@param toTokenize the string to tokenize.
@return The tokenizer. | [
"Create",
"a",
"Tokenizer",
"instance",
"for",
"the",
"given",
"sentence",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/org/deeplearning4j/text/tokenization/tokenizerfactory/JapaneseTokenizerFactory.java#L74-L87 |
128,021 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/recurrent/KerasLSTM.java | KerasLSTM.getGateActivationFromConfig | public IActivation getGateActivationFromConfig(Map<String, Object> layerConfig)
throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
if (!innerConfig.containsKey... | java | public IActivation getGateActivationFromConfig(Map<String, Object> layerConfig)
throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
if (!innerConfig.containsKey... | [
"public",
"IActivation",
"getGateActivationFromConfig",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
")",
"throws",
"InvalidKerasConfigurationException",
",",
"UnsupportedKerasConfigurationException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"inne... | Get LSTM gate activation function from Keras layer configuration.
@param layerConfig dictionary containing Keras layer configuration
@return LSTM inner activation function
@throws InvalidKerasConfigurationException Invalid Keras config | [
"Get",
"LSTM",
"gate",
"activation",
"function",
"from",
"Keras",
"layer",
"configuration",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/recurrent/KerasLSTM.java#L463-L470 |
128,022 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/recurrent/KerasLSTM.java | KerasLSTM.getForgetBiasInitFromConfig | public double getForgetBiasInitFromConfig(Map<String, Object> layerConfig, boolean train)
throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
String kerasForget... | java | public double getForgetBiasInitFromConfig(Map<String, Object> layerConfig, boolean train)
throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
String kerasForget... | [
"public",
"double",
"getForgetBiasInitFromConfig",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
",",
"boolean",
"train",
")",
"throws",
"InvalidKerasConfigurationException",
",",
"UnsupportedKerasConfigurationException",
"{",
"Map",
"<",
"String",
",",
... | Get LSTM forget gate bias initialization from Keras layer configuration.
@param layerConfig dictionary containing Keras layer configuration
@return LSTM forget gate bias init
@throws InvalidKerasConfigurationException Unsupported Keras config | [
"Get",
"LSTM",
"forget",
"gate",
"bias",
"initialization",
"from",
"Keras",
"layer",
"configuration",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/recurrent/KerasLSTM.java#L479-L511 |
128,023 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-manifold/deeplearning4j-tsne/src/main/java/org/deeplearning4j/plot/BarnesHutTsne.java | BarnesHutTsne.saveAsFile | public void saveAsFile(List<String> labels, String path) throws IOException {
BufferedWriter write = null;
try {
write = new BufferedWriter(new FileWriter(new File(path)));
for (int i = 0; i < Y.rows(); i++) {
if (i >= labels.size())
break;
... | java | public void saveAsFile(List<String> labels, String path) throws IOException {
BufferedWriter write = null;
try {
write = new BufferedWriter(new FileWriter(new File(path)));
for (int i = 0; i < Y.rows(); i++) {
if (i >= labels.size())
break;
... | [
"public",
"void",
"saveAsFile",
"(",
"List",
"<",
"String",
">",
"labels",
",",
"String",
"path",
")",
"throws",
"IOException",
"{",
"BufferedWriter",
"write",
"=",
"null",
";",
"try",
"{",
"write",
"=",
"new",
"BufferedWriter",
"(",
"new",
"FileWriter",
"... | Save the model as a file with a csv format, adding the label as the last column.
@param labels
@param path the path to write
@throws IOException | [
"Save",
"the",
"model",
"as",
"a",
"file",
"with",
"a",
"csv",
"format",
"adding",
"the",
"label",
"as",
"the",
"last",
"column",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-manifold/deeplearning4j-tsne/src/main/java/org/deeplearning4j/plot/BarnesHutTsne.java#L618-L648 |
128,024 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-manifold/deeplearning4j-tsne/src/main/java/org/deeplearning4j/plot/BarnesHutTsne.java | BarnesHutTsne.fit | @Deprecated
public void fit(INDArray data, int nDims) {
this.x = data;
this.numDimensions = nDims;
fit();
} | java | @Deprecated
public void fit(INDArray data, int nDims) {
this.x = data;
this.numDimensions = nDims;
fit();
} | [
"@",
"Deprecated",
"public",
"void",
"fit",
"(",
"INDArray",
"data",
",",
"int",
"nDims",
")",
"{",
"this",
".",
"x",
"=",
"data",
";",
"this",
".",
"numDimensions",
"=",
"nDims",
";",
"fit",
"(",
")",
";",
"}"
] | Change the dimensions with
@deprecated Use {@link #fit(INDArray)} | [
"Change",
"the",
"dimensions",
"with"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-manifold/deeplearning4j-tsne/src/main/java/org/deeplearning4j/plot/BarnesHutTsne.java#L767-L772 |
128,025 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CheckpointListener.java | CheckpointListener.lastCheckpoint | public static Checkpoint lastCheckpoint(File rootDir){
List<Checkpoint> all = availableCheckpoints(rootDir);
if(all.isEmpty()){
return null;
}
return all.get(all.size()-1);
} | java | public static Checkpoint lastCheckpoint(File rootDir){
List<Checkpoint> all = availableCheckpoints(rootDir);
if(all.isEmpty()){
return null;
}
return all.get(all.size()-1);
} | [
"public",
"static",
"Checkpoint",
"lastCheckpoint",
"(",
"File",
"rootDir",
")",
"{",
"List",
"<",
"Checkpoint",
">",
"all",
"=",
"availableCheckpoints",
"(",
"rootDir",
")",
";",
"if",
"(",
"all",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";... | Return the most recent checkpoint, if one exists - otherwise returns null
@param rootDir Root direcotry for the checkpoint files
@return Checkpoint | [
"Return",
"the",
"most",
"recent",
"checkpoint",
"if",
"one",
"exists",
"-",
"otherwise",
"returns",
"null"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CheckpointListener.java#L385-L391 |
128,026 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CheckpointListener.java | CheckpointListener.loadCheckpointMLN | public static MultiLayerNetwork loadCheckpointMLN(File rootDir, Checkpoint checkpoint) {
return loadCheckpointMLN(rootDir, checkpoint.getCheckpointNum());
} | java | public static MultiLayerNetwork loadCheckpointMLN(File rootDir, Checkpoint checkpoint) {
return loadCheckpointMLN(rootDir, checkpoint.getCheckpointNum());
} | [
"public",
"static",
"MultiLayerNetwork",
"loadCheckpointMLN",
"(",
"File",
"rootDir",
",",
"Checkpoint",
"checkpoint",
")",
"{",
"return",
"loadCheckpointMLN",
"(",
"rootDir",
",",
"checkpoint",
".",
"getCheckpointNum",
"(",
")",
")",
";",
"}"
] | Load a MultiLayerNetwork for the given checkpoint that resides in the specified root directory
@param rootDir Root directory for the checkpoint
@param checkpoint Checkpoint model to load
@return The loaded model | [
"Load",
"a",
"MultiLayerNetwork",
"for",
"the",
"given",
"checkpoint",
"that",
"resides",
"in",
"the",
"specified",
"root",
"directory"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CheckpointListener.java#L454-L456 |
128,027 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CheckpointListener.java | CheckpointListener.loadCheckpointMLN | public static MultiLayerNetwork loadCheckpointMLN(File rootDir, int checkpointNum){
File f = getFileForCheckpoint(rootDir, checkpointNum);
try {
return ModelSerializer.restoreMultiLayerNetwork(f, true);
} catch (IOException e){
throw new RuntimeException(e);
}
... | java | public static MultiLayerNetwork loadCheckpointMLN(File rootDir, int checkpointNum){
File f = getFileForCheckpoint(rootDir, checkpointNum);
try {
return ModelSerializer.restoreMultiLayerNetwork(f, true);
} catch (IOException e){
throw new RuntimeException(e);
}
... | [
"public",
"static",
"MultiLayerNetwork",
"loadCheckpointMLN",
"(",
"File",
"rootDir",
",",
"int",
"checkpointNum",
")",
"{",
"File",
"f",
"=",
"getFileForCheckpoint",
"(",
"rootDir",
",",
"checkpointNum",
")",
";",
"try",
"{",
"return",
"ModelSerializer",
".",
"... | Load a MultiLayerNetwork for the given checkpoint number
@param rootDir The directory that the checkpoint resides in
@param checkpointNum Checkpoint model to load
@return The loaded model | [
"Load",
"a",
"MultiLayerNetwork",
"for",
"the",
"given",
"checkpoint",
"number"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CheckpointListener.java#L465-L472 |
128,028 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CheckpointListener.java | CheckpointListener.loadCheckpointCG | public static ComputationGraph loadCheckpointCG(File rootDir, Checkpoint checkpoint){
return loadCheckpointCG(rootDir, checkpoint.getCheckpointNum());
} | java | public static ComputationGraph loadCheckpointCG(File rootDir, Checkpoint checkpoint){
return loadCheckpointCG(rootDir, checkpoint.getCheckpointNum());
} | [
"public",
"static",
"ComputationGraph",
"loadCheckpointCG",
"(",
"File",
"rootDir",
",",
"Checkpoint",
"checkpoint",
")",
"{",
"return",
"loadCheckpointCG",
"(",
"rootDir",
",",
"checkpoint",
".",
"getCheckpointNum",
"(",
")",
")",
";",
"}"
] | Load a ComputationGraph for the given checkpoint from the specified root direcotry
@param checkpoint Checkpoint model to load
@return The loaded model | [
"Load",
"a",
"ComputationGraph",
"for",
"the",
"given",
"checkpoint",
"from",
"the",
"specified",
"root",
"direcotry"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CheckpointListener.java#L500-L502 |
128,029 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CheckpointListener.java | CheckpointListener.loadCheckpointCG | public static ComputationGraph loadCheckpointCG(File rootDir, int checkpointNum){
File f = getFileForCheckpoint(rootDir, checkpointNum);
try {
return ModelSerializer.restoreComputationGraph(f, true);
} catch (IOException e){
throw new RuntimeException(e);
}
} | java | public static ComputationGraph loadCheckpointCG(File rootDir, int checkpointNum){
File f = getFileForCheckpoint(rootDir, checkpointNum);
try {
return ModelSerializer.restoreComputationGraph(f, true);
} catch (IOException e){
throw new RuntimeException(e);
}
} | [
"public",
"static",
"ComputationGraph",
"loadCheckpointCG",
"(",
"File",
"rootDir",
",",
"int",
"checkpointNum",
")",
"{",
"File",
"f",
"=",
"getFileForCheckpoint",
"(",
"rootDir",
",",
"checkpointNum",
")",
";",
"try",
"{",
"return",
"ModelSerializer",
".",
"re... | Load a ComputationGraph for the given checkpoint that resides in the specified root directory
@param rootDir Directory that the checkpoint resides in
@param checkpointNum Checkpoint model number to load
@return The loaded model | [
"Load",
"a",
"ComputationGraph",
"for",
"the",
"given",
"checkpoint",
"that",
"resides",
"in",
"the",
"specified",
"root",
"directory"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/CheckpointListener.java#L521-L528 |
128,030 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/solvers/BaseOptimizer.java | BaseOptimizer.setupSearchState | @Override
public void setupSearchState(Pair<Gradient, Double> pair) {
INDArray gradient = pair.getFirst().gradient(conf.variables());
INDArray params = model.params().dup(); //Need dup here: params returns an array that isn't a copy (hence changes to this are problematic for line search methods)
... | java | @Override
public void setupSearchState(Pair<Gradient, Double> pair) {
INDArray gradient = pair.getFirst().gradient(conf.variables());
INDArray params = model.params().dup(); //Need dup here: params returns an array that isn't a copy (hence changes to this are problematic for line search methods)
... | [
"@",
"Override",
"public",
"void",
"setupSearchState",
"(",
"Pair",
"<",
"Gradient",
",",
"Double",
">",
"pair",
")",
"{",
"INDArray",
"gradient",
"=",
"pair",
".",
"getFirst",
"(",
")",
".",
"gradient",
"(",
"conf",
".",
"variables",
"(",
")",
")",
";... | Setup the initial search state
@param pair | [
"Setup",
"the",
"initial",
"search",
"state"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/solvers/BaseOptimizer.java#L303-L310 |
128,031 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/NetworkUtils.java | NetworkUtils.toComputationGraph | public static ComputationGraph toComputationGraph(MultiLayerNetwork net) {
//We rely heavily here on the fact that the topological sort order - and hence the layout of parameters - is
// by definition the identical for a MLN and "single stack" computation graph. This also has to hold
// for the... | java | public static ComputationGraph toComputationGraph(MultiLayerNetwork net) {
//We rely heavily here on the fact that the topological sort order - and hence the layout of parameters - is
// by definition the identical for a MLN and "single stack" computation graph. This also has to hold
// for the... | [
"public",
"static",
"ComputationGraph",
"toComputationGraph",
"(",
"MultiLayerNetwork",
"net",
")",
"{",
"//We rely heavily here on the fact that the topological sort order - and hence the layout of parameters - is",
"// by definition the identical for a MLN and \"single stack\" computation grap... | Convert a MultiLayerNetwork to a ComputationGraph
@return ComputationGraph equivalent to this network (including parameters and updater state) | [
"Convert",
"a",
"MultiLayerNetwork",
"to",
"a",
"ComputationGraph"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/NetworkUtils.java#L56-L98 |
128,032 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/algorithm/BaseClusteringAlgorithm.java | BaseClusteringAlgorithm.iterations | private void iterations() {
int iterationCount = 0;
while ((clusteringStrategy.getTerminationCondition() != null
&& !clusteringStrategy.getTerminationCondition().isSatisfied(iterationHistory))
|| iterationHistory.getMostRecentIterationInfo().isStrategyAppl... | java | private void iterations() {
int iterationCount = 0;
while ((clusteringStrategy.getTerminationCondition() != null
&& !clusteringStrategy.getTerminationCondition().isSatisfied(iterationHistory))
|| iterationHistory.getMostRecentIterationInfo().isStrategyAppl... | [
"private",
"void",
"iterations",
"(",
")",
"{",
"int",
"iterationCount",
"=",
"0",
";",
"while",
"(",
"(",
"clusteringStrategy",
".",
"getTerminationCondition",
"(",
")",
"!=",
"null",
"&&",
"!",
"clusteringStrategy",
".",
"getTerminationCondition",
"(",
")",
... | Run clustering iterations until a
termination condition is hit.
This is done by first classifying all points,
and then updating cluster centers based on
those classified points | [
"Run",
"clustering",
"iterations",
"until",
"a",
"termination",
"condition",
"is",
"hit",
".",
"This",
"is",
"done",
"by",
"first",
"classifying",
"all",
"points",
"and",
"then",
"updating",
"cluster",
"centers",
"based",
"on",
"those",
"classified",
"points"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/algorithm/BaseClusteringAlgorithm.java#L107-L118 |
128,033 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/algorithm/BaseClusteringAlgorithm.java | BaseClusteringAlgorithm.initClusters | protected void initClusters() {
log.info("Generating initial clusters");
List<Point> points = new ArrayList<>(initialPoints);
//Initialize the ClusterSet with a single cluster center (based on position of one of the points chosen randomly)
val random = Nd4j.getRandom();
Distance... | java | protected void initClusters() {
log.info("Generating initial clusters");
List<Point> points = new ArrayList<>(initialPoints);
//Initialize the ClusterSet with a single cluster center (based on position of one of the points chosen randomly)
val random = Nd4j.getRandom();
Distance... | [
"protected",
"void",
"initClusters",
"(",
")",
"{",
"log",
".",
"info",
"(",
"\"Generating initial clusters\"",
")",
";",
"List",
"<",
"Point",
">",
"points",
"=",
"new",
"ArrayList",
"<>",
"(",
"initialPoints",
")",
";",
"//Initialize the ClusterSet with a single... | Initialize the
cluster centers at random | [
"Initialize",
"the",
"cluster",
"centers",
"at",
"random"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/algorithm/BaseClusteringAlgorithm.java#L133-L171 |
128,034 | deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-audio/src/main/java/org/datavec/audio/processor/ArrayRankDouble.java | ArrayRankDouble.getMaxValueIndex | public int getMaxValueIndex(double[] array) {
int index = 0;
double max = Integer.MIN_VALUE;
for (int i = 0; i < array.length; i++) {
if (array[i] > max) {
max = array[i];
index = i;
}
}
return index;
} | java | public int getMaxValueIndex(double[] array) {
int index = 0;
double max = Integer.MIN_VALUE;
for (int i = 0; i < array.length; i++) {
if (array[i] > max) {
max = array[i];
index = i;
}
}
return index;
} | [
"public",
"int",
"getMaxValueIndex",
"(",
"double",
"[",
"]",
"array",
")",
"{",
"int",
"index",
"=",
"0",
";",
"double",
"max",
"=",
"Integer",
".",
"MIN_VALUE",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
... | Get the index position of maximum value the given array
@param array an array
@return index of the max value in array | [
"Get",
"the",
"index",
"position",
"of",
"maximum",
"value",
"the",
"given",
"array"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-audio/src/main/java/org/datavec/audio/processor/ArrayRankDouble.java#L26-L39 |
128,035 | deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-audio/src/main/java/org/datavec/audio/processor/ArrayRankDouble.java | ArrayRankDouble.getMinValueIndex | public int getMinValueIndex(double[] array) {
int index = 0;
double min = Integer.MAX_VALUE;
for (int i = 0; i < array.length; i++) {
if (array[i] < min) {
min = array[i];
index = i;
}
}
return index;
} | java | public int getMinValueIndex(double[] array) {
int index = 0;
double min = Integer.MAX_VALUE;
for (int i = 0; i < array.length; i++) {
if (array[i] < min) {
min = array[i];
index = i;
}
}
return index;
} | [
"public",
"int",
"getMinValueIndex",
"(",
"double",
"[",
"]",
"array",
")",
"{",
"int",
"index",
"=",
"0",
";",
"double",
"min",
"=",
"Integer",
".",
"MAX_VALUE",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
... | Get the index position of minimum value in the given array
@param array an array
@return index of the min value in array | [
"Get",
"the",
"index",
"position",
"of",
"minimum",
"value",
"in",
"the",
"given",
"array"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-audio/src/main/java/org/datavec/audio/processor/ArrayRankDouble.java#L46-L59 |
128,036 | deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-audio/src/main/java/org/datavec/audio/processor/ArrayRankDouble.java | ArrayRankDouble.getNthOrderedValue | public double getNthOrderedValue(double[] array, int n, boolean ascending) {
if (n > array.length) {
n = array.length;
}
int targetindex;
if (ascending) {
targetindex = n;
} else {
targetindex = array.length - n;
}
// this va... | java | public double getNthOrderedValue(double[] array, int n, boolean ascending) {
if (n > array.length) {
n = array.length;
}
int targetindex;
if (ascending) {
targetindex = n;
} else {
targetindex = array.length - n;
}
// this va... | [
"public",
"double",
"getNthOrderedValue",
"(",
"double",
"[",
"]",
"array",
",",
"int",
"n",
",",
"boolean",
"ascending",
")",
"{",
"if",
"(",
"n",
">",
"array",
".",
"length",
")",
"{",
"n",
"=",
"array",
".",
"length",
";",
"}",
"int",
"targetindex... | Get the n-th value in the array after sorted
@param array an array
@param n position in array
@param ascending is ascending order or not
@return value at nth position of array | [
"Get",
"the",
"n",
"-",
"th",
"value",
"in",
"the",
"array",
"after",
"sorted"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-audio/src/main/java/org/datavec/audio/processor/ArrayRankDouble.java#L68-L84 |
128,037 | deeplearning4j/deeplearning4j | rl4j/rl4j-core/src/main/java/org/deeplearning4j/rl4j/learning/sync/Transition.java | Transition.concat | public static INDArray concat(INDArray[] history) {
INDArray arr = Nd4j.concat(0, history);
return arr;
} | java | public static INDArray concat(INDArray[] history) {
INDArray arr = Nd4j.concat(0, history);
return arr;
} | [
"public",
"static",
"INDArray",
"concat",
"(",
"INDArray",
"[",
"]",
"history",
")",
"{",
"INDArray",
"arr",
"=",
"Nd4j",
".",
"concat",
"(",
"0",
",",
"history",
")",
";",
"return",
"arr",
";",
"}"
] | concat an array history into a single INDArry of as many channel
as element in the history array
@param history the history to concat
@return the multi-channel INDArray | [
"concat",
"an",
"array",
"history",
"into",
"a",
"single",
"INDArry",
"of",
"as",
"many",
"channel",
"as",
"element",
"in",
"the",
"history",
"array"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/rl4j/rl4j-core/src/main/java/org/deeplearning4j/rl4j/learning/sync/Transition.java#L44-L47 |
128,038 | deeplearning4j/deeplearning4j | rl4j/rl4j-core/src/main/java/org/deeplearning4j/rl4j/learning/sync/Transition.java | Transition.dup | public Transition<A> dup() {
INDArray[] dupObservation = dup(observation);
INDArray nextObs = nextObservation.dup();
return new Transition<>(dupObservation, action, reward, isTerminal, nextObs);
} | java | public Transition<A> dup() {
INDArray[] dupObservation = dup(observation);
INDArray nextObs = nextObservation.dup();
return new Transition<>(dupObservation, action, reward, isTerminal, nextObs);
} | [
"public",
"Transition",
"<",
"A",
">",
"dup",
"(",
")",
"{",
"INDArray",
"[",
"]",
"dupObservation",
"=",
"dup",
"(",
"observation",
")",
";",
"INDArray",
"nextObs",
"=",
"nextObservation",
".",
"dup",
"(",
")",
";",
"return",
"new",
"Transition",
"<>",
... | Duplicate this transition
@return this transition duplicated | [
"Duplicate",
"this",
"transition"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/rl4j/rl4j-core/src/main/java/org/deeplearning4j/rl4j/learning/sync/Transition.java#L53-L58 |
128,039 | deeplearning4j/deeplearning4j | rl4j/rl4j-core/src/main/java/org/deeplearning4j/rl4j/learning/sync/Transition.java | Transition.dup | public static INDArray[] dup(INDArray[] history) {
INDArray[] dupHistory = new INDArray[history.length];
for (int i = 0; i < history.length; i++) {
dupHistory[i] = history[i].dup();
}
return dupHistory;
} | java | public static INDArray[] dup(INDArray[] history) {
INDArray[] dupHistory = new INDArray[history.length];
for (int i = 0; i < history.length; i++) {
dupHistory[i] = history[i].dup();
}
return dupHistory;
} | [
"public",
"static",
"INDArray",
"[",
"]",
"dup",
"(",
"INDArray",
"[",
"]",
"history",
")",
"{",
"INDArray",
"[",
"]",
"dupHistory",
"=",
"new",
"INDArray",
"[",
"history",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
... | Duplicate an history
@param history the history to duplicate
@return a duplicate of the history | [
"Duplicate",
"an",
"history"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/rl4j/rl4j-core/src/main/java/org/deeplearning4j/rl4j/learning/sync/Transition.java#L65-L71 |
128,040 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-native-api/src/main/java/org/nd4j/autodiff/execution/NativeGraphExecutioner.java | NativeGraphExecutioner.executeGraph | @Override
public INDArray[] executeGraph(SameDiff sd) {
return executeGraph(sd, ExecutorConfiguration.builder().outputMode(OutputMode.IMPLICIT).executionMode(ExecutionMode.SEQUENTIAL).profilingMode(OpExecutioner.ProfilingMode.DISABLED).build());
} | java | @Override
public INDArray[] executeGraph(SameDiff sd) {
return executeGraph(sd, ExecutorConfiguration.builder().outputMode(OutputMode.IMPLICIT).executionMode(ExecutionMode.SEQUENTIAL).profilingMode(OpExecutioner.ProfilingMode.DISABLED).build());
} | [
"@",
"Override",
"public",
"INDArray",
"[",
"]",
"executeGraph",
"(",
"SameDiff",
"sd",
")",
"{",
"return",
"executeGraph",
"(",
"sd",
",",
"ExecutorConfiguration",
".",
"builder",
"(",
")",
".",
"outputMode",
"(",
"OutputMode",
".",
"IMPLICIT",
")",
".",
... | This method executes given graph and returns results
PLEASE NOTE: Default configuration is used
@param sd
@return | [
"This",
"method",
"executes",
"given",
"graph",
"and",
"returns",
"results"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-native-api/src/main/java/org/nd4j/autodiff/execution/NativeGraphExecutioner.java#L73-L76 |
128,041 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/internal/AbstractSession.java | AbstractSession.get | public T get(String variable, String frame, int iteration, FrameIter parentFrameIter) {
return get(variable, frame, iteration, parentFrameIter, true);
} | java | public T get(String variable, String frame, int iteration, FrameIter parentFrameIter) {
return get(variable, frame, iteration, parentFrameIter, true);
} | [
"public",
"T",
"get",
"(",
"String",
"variable",
",",
"String",
"frame",
",",
"int",
"iteration",
",",
"FrameIter",
"parentFrameIter",
")",
"{",
"return",
"get",
"(",
"variable",
",",
"frame",
",",
"iteration",
",",
"parentFrameIter",
",",
"true",
")",
";"... | Get a previously calculated output; throws an exception if the output does not exist | [
"Get",
"a",
"previously",
"calculated",
"output",
";",
"throws",
"an",
"exception",
"if",
"the",
"output",
"does",
"not",
"exist"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/internal/AbstractSession.java#L90-L92 |
128,042 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/internal/AbstractSession.java | AbstractSession.get | public T get(String variable, String frame, int iteration, FrameIter parentFrameIter, boolean enforceExistence) {
//TODO eventually we'll cache and reuse VarId objects here to avoid garbage generation on lookup etc
VarId varId = newVarId(variable, frame, iteration, parentFrameIter);
T out = node... | java | public T get(String variable, String frame, int iteration, FrameIter parentFrameIter, boolean enforceExistence) {
//TODO eventually we'll cache and reuse VarId objects here to avoid garbage generation on lookup etc
VarId varId = newVarId(variable, frame, iteration, parentFrameIter);
T out = node... | [
"public",
"T",
"get",
"(",
"String",
"variable",
",",
"String",
"frame",
",",
"int",
"iteration",
",",
"FrameIter",
"parentFrameIter",
",",
"boolean",
"enforceExistence",
")",
"{",
"//TODO eventually we'll cache and reuse VarId objects here to avoid garbage generation on look... | Get a previously calculated output
@param enforceExistence If true: throw an exception if the array does not exist | [
"Get",
"a",
"previously",
"calculated",
"output"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/internal/AbstractSession.java#L98-L106 |
128,043 | deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/transform/LargestBlobCropTransform.java | LargestBlobCropTransform.doTransform | @Override
protected ImageWritable doTransform(ImageWritable image, Random random) {
if (image == null) {
return null;
}
//Convert image to gray and blur
Mat original = converter.convert(image.getFrame());
Mat grayed = new Mat();
cvtColor(original, grayed,... | java | @Override
protected ImageWritable doTransform(ImageWritable image, Random random) {
if (image == null) {
return null;
}
//Convert image to gray and blur
Mat original = converter.convert(image.getFrame());
Mat grayed = new Mat();
cvtColor(original, grayed,... | [
"@",
"Override",
"protected",
"ImageWritable",
"doTransform",
"(",
"ImageWritable",
"image",
",",
"Random",
"random",
")",
"{",
"if",
"(",
"image",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"//Convert image to gray and blur",
"Mat",
"original",
"=",
... | Takes an image and returns a cropped image based on it's largest blob.
@param image to transform, null == end of stream
@param random object to use (or null for deterministic)
@return transformed image | [
"Takes",
"an",
"image",
"and",
"returns",
"a",
"cropped",
"image",
"based",
"on",
"it",
"s",
"largest",
"blob",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/transform/LargestBlobCropTransform.java#L94-L137 |
128,044 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/weights/WeightInitIdentity.java | WeightInitIdentity.setIdentityConv | private INDArray setIdentityConv(long[] shape, char order, INDArray paramView) {
final INDArrayIndex[] indArrayIndices = new INDArrayIndex[shape.length];
for(int i = 2; i < shape.length; i++) {
if(shape[i] % 2 == 0) {
throw new IllegalStateException("Cannot use IDENTITY init ... | java | private INDArray setIdentityConv(long[] shape, char order, INDArray paramView) {
final INDArrayIndex[] indArrayIndices = new INDArrayIndex[shape.length];
for(int i = 2; i < shape.length; i++) {
if(shape[i] % 2 == 0) {
throw new IllegalStateException("Cannot use IDENTITY init ... | [
"private",
"INDArray",
"setIdentityConv",
"(",
"long",
"[",
"]",
"shape",
",",
"char",
"order",
",",
"INDArray",
"paramView",
")",
"{",
"final",
"INDArrayIndex",
"[",
"]",
"indArrayIndices",
"=",
"new",
"INDArrayIndex",
"[",
"shape",
".",
"length",
"]",
";",... | Set identity mapping for convolution layers. When viewed as an NxM matrix of kernel tensors,
identity mapping is when parameters is a diagonal matrix of identity kernels.
@param shape Shape of parameters
@param order Order of parameters
@param paramView View of parameters
@return A reshaped view of paramView which resu... | [
"Set",
"identity",
"mapping",
"for",
"convolution",
"layers",
".",
"When",
"viewed",
"as",
"an",
"NxM",
"matrix",
"of",
"kernel",
"tensors",
"identity",
"mapping",
"is",
"when",
"parameters",
"is",
"a",
"diagonal",
"matrix",
"of",
"identity",
"kernels",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/weights/WeightInitIdentity.java#L59-L77 |
128,045 | deeplearning4j/deeplearning4j | arbiter/arbiter-core/src/main/java/org/deeplearning4j/arbiter/util/LeafUtils.java | LeafUtils.countUniqueParameters | public static int countUniqueParameters(List<ParameterSpace> allLeaves) {
List<ParameterSpace> unique = getUniqueObjects(allLeaves);
int count = 0;
for (ParameterSpace ps : unique) {
if (!ps.isLeaf()) {
throw new IllegalStateException("Method should only be used with ... | java | public static int countUniqueParameters(List<ParameterSpace> allLeaves) {
List<ParameterSpace> unique = getUniqueObjects(allLeaves);
int count = 0;
for (ParameterSpace ps : unique) {
if (!ps.isLeaf()) {
throw new IllegalStateException("Method should only be used with ... | [
"public",
"static",
"int",
"countUniqueParameters",
"(",
"List",
"<",
"ParameterSpace",
">",
"allLeaves",
")",
"{",
"List",
"<",
"ParameterSpace",
">",
"unique",
"=",
"getUniqueObjects",
"(",
"allLeaves",
")",
";",
"int",
"count",
"=",
"0",
";",
"for",
"(",
... | Count the number of unique parameters in the specified leaf nodes
@param allLeaves Leaf values to count the parameters fore
@return Number of parameters for all unique objects | [
"Count",
"the",
"number",
"of",
"unique",
"parameters",
"in",
"the",
"specified",
"leaf",
"nodes"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/arbiter/arbiter-core/src/main/java/org/deeplearning4j/arbiter/util/LeafUtils.java#L61-L71 |
128,046 | deeplearning4j/deeplearning4j | nd4j/nd4j-serde/nd4j-aeron/src/main/java/org/nd4j/aeron/ipc/AeronConnectionInformation.java | AeronConnectionInformation.of | public static AeronConnectionInformation of(String connectionHost, int connectionPort, int streamId) {
return AeronConnectionInformation.builder().connectionHost(connectionHost).connectionPort(connectionPort)
.streamId(streamId).build();
} | java | public static AeronConnectionInformation of(String connectionHost, int connectionPort, int streamId) {
return AeronConnectionInformation.builder().connectionHost(connectionHost).connectionPort(connectionPort)
.streamId(streamId).build();
} | [
"public",
"static",
"AeronConnectionInformation",
"of",
"(",
"String",
"connectionHost",
",",
"int",
"connectionPort",
",",
"int",
"streamId",
")",
"{",
"return",
"AeronConnectionInformation",
".",
"builder",
"(",
")",
".",
"connectionHost",
"(",
"connectionHost",
"... | Traditional static generator method
@param connectionHost
@param connectionPort
@param streamId
@return | [
"Traditional",
"static",
"generator",
"method"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-serde/nd4j-aeron/src/main/java/org/nd4j/aeron/ipc/AeronConnectionInformation.java#L44-L47 |
128,047 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/ROC.java | ROC.merge | @Override
public void merge(ROC other) {
if (this.thresholdSteps != other.thresholdSteps) {
throw new UnsupportedOperationException(
"Cannot merge ROC instances with different numbers of threshold steps ("
+ this.thresholdSteps + " vs. " + other.th... | java | @Override
public void merge(ROC other) {
if (this.thresholdSteps != other.thresholdSteps) {
throw new UnsupportedOperationException(
"Cannot merge ROC instances with different numbers of threshold steps ("
+ this.thresholdSteps + " vs. " + other.th... | [
"@",
"Override",
"public",
"void",
"merge",
"(",
"ROC",
"other",
")",
"{",
"if",
"(",
"this",
".",
"thresholdSteps",
"!=",
"other",
".",
"thresholdSteps",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Cannot merge ROC instances with different nu... | Merge this ROC instance with another.
This ROC instance is modified, by adding the stats from the other instance.
@param other ROC instance to combine with this one | [
"Merge",
"this",
"ROC",
"instance",
"with",
"another",
".",
"This",
"ROC",
"instance",
"is",
"modified",
"by",
"adding",
"the",
"stats",
"from",
"the",
"other",
"instance",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/ROC.java#L709-L757 |
128,048 | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/linalg/io/ClassPathResource.java | ClassPathResource.extractActualUrl | private URL extractActualUrl(URL jarUrl) throws MalformedURLException {
String urlFile = jarUrl.getFile();
int separatorIndex = urlFile.indexOf("!/");
if (separatorIndex != -1) {
String jarFile = urlFile.substring(0, separatorIndex);
try {
return new URL(... | java | private URL extractActualUrl(URL jarUrl) throws MalformedURLException {
String urlFile = jarUrl.getFile();
int separatorIndex = urlFile.indexOf("!/");
if (separatorIndex != -1) {
String jarFile = urlFile.substring(0, separatorIndex);
try {
return new URL(... | [
"private",
"URL",
"extractActualUrl",
"(",
"URL",
"jarUrl",
")",
"throws",
"MalformedURLException",
"{",
"String",
"urlFile",
"=",
"jarUrl",
".",
"getFile",
"(",
")",
";",
"int",
"separatorIndex",
"=",
"urlFile",
".",
"indexOf",
"(",
"\"!/\"",
")",
";",
"if"... | Extracts parent Jar URL from original ClassPath entry URL.
@param jarUrl Original URL of the resource
@return URL of the Jar file, containing requested resource
@throws MalformedURLException | [
"Extracts",
"parent",
"Jar",
"URL",
"from",
"original",
"ClassPath",
"entry",
"URL",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/io/ClassPathResource.java#L421-L439 |
128,049 | deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-status/src/main/java/org/nd4j/parameterserver/status/play/BaseStatusStorage.java | BaseStatusStorage.updateState | @Override
public void updateState(SubscriberState subscriberState) {
updated.put(subscriberState.getStreamId(), System.currentTimeMillis());
statusStorageMap.put(subscriberState.getStreamId(), subscriberState);
} | java | @Override
public void updateState(SubscriberState subscriberState) {
updated.put(subscriberState.getStreamId(), System.currentTimeMillis());
statusStorageMap.put(subscriberState.getStreamId(), subscriberState);
} | [
"@",
"Override",
"public",
"void",
"updateState",
"(",
"SubscriberState",
"subscriberState",
")",
"{",
"updated",
".",
"put",
"(",
"subscriberState",
".",
"getStreamId",
"(",
")",
",",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",
"statusStorageMap",
... | Update the state for storage
@param subscriberState the subscriber state to update | [
"Update",
"the",
"state",
"for",
"storage"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-status/src/main/java/org/nd4j/parameterserver/status/play/BaseStatusStorage.java#L150-L154 |
128,050 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/deeplearning4j-scaleout-parallelwrapper-parameter-server/src/main/java/org/deeplearning4j/parallelism/parameterserver/ParameterServerTrainerContext.java | ParameterServerTrainerContext.init | @Override
public void init(Model model, Object... args) {
mediaDriverContext = new MediaDriver.Context();
mediaDriver = MediaDriver.launchEmbedded(mediaDriverContext);
parameterServerNode = new ParameterServerNode(mediaDriver, statusServerPort, numWorkers);
if (parameterServerArgs ==... | java | @Override
public void init(Model model, Object... args) {
mediaDriverContext = new MediaDriver.Context();
mediaDriver = MediaDriver.launchEmbedded(mediaDriverContext);
parameterServerNode = new ParameterServerNode(mediaDriver, statusServerPort, numWorkers);
if (parameterServerArgs ==... | [
"@",
"Override",
"public",
"void",
"init",
"(",
"Model",
"model",
",",
"Object",
"...",
"args",
")",
"{",
"mediaDriverContext",
"=",
"new",
"MediaDriver",
".",
"Context",
"(",
")",
";",
"mediaDriver",
"=",
"MediaDriver",
".",
"launchEmbedded",
"(",
"mediaDri... | Initialize the context
@param model
@param args the arguments to initialize with (maybe null) | [
"Initialize",
"the",
"context"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/deeplearning4j-scaleout-parallelwrapper-parameter-server/src/main/java/org/deeplearning4j/parallelism/parameterserver/ParameterServerTrainerContext.java#L51-L62 |
128,051 | deeplearning4j/deeplearning4j | gym-java-client/src/main/java/org/deeplearning4j/gym/Client.java | Client.step | public StepReply<O> step(A action) {
JSONObject body = new JSONObject().put("action", getActionSpace().encode(action)).put("render", render);
JSONObject reply = ClientUtils.post(url + ENVS_ROOT + instanceId + STEP, body).getObject();
O observation = observationSpace.getValue(reply, "observatio... | java | public StepReply<O> step(A action) {
JSONObject body = new JSONObject().put("action", getActionSpace().encode(action)).put("render", render);
JSONObject reply = ClientUtils.post(url + ENVS_ROOT + instanceId + STEP, body).getObject();
O observation = observationSpace.getValue(reply, "observatio... | [
"public",
"StepReply",
"<",
"O",
">",
"step",
"(",
"A",
"action",
")",
"{",
"JSONObject",
"body",
"=",
"new",
"JSONObject",
"(",
")",
".",
"put",
"(",
"\"action\"",
",",
"getActionSpace",
"(",
")",
".",
"encode",
"(",
"action",
")",
")",
".",
"put",
... | Step the environment by one action
@param action action to step the environment with
@return the StepReply containing the next observation, the reward, if it is a terminal state and optional information. | [
"Step",
"the",
"environment",
"by",
"one",
"action"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/gym-java-client/src/main/java/org/deeplearning4j/gym/Client.java#L98-L109 |
128,052 | deeplearning4j/deeplearning4j | gym-java-client/src/main/java/org/deeplearning4j/gym/Client.java | Client.reset | public O reset() {
JsonNode resetRep = ClientUtils.post(url + ENVS_ROOT + instanceId + RESET, new JSONObject());
return observationSpace.getValue(resetRep.getObject(), "observation");
} | java | public O reset() {
JsonNode resetRep = ClientUtils.post(url + ENVS_ROOT + instanceId + RESET, new JSONObject());
return observationSpace.getValue(resetRep.getObject(), "observation");
} | [
"public",
"O",
"reset",
"(",
")",
"{",
"JsonNode",
"resetRep",
"=",
"ClientUtils",
".",
"post",
"(",
"url",
"+",
"ENVS_ROOT",
"+",
"instanceId",
"+",
"RESET",
",",
"new",
"JSONObject",
"(",
")",
")",
";",
"return",
"observationSpace",
".",
"getValue",
"(... | Reset the state of the environment and return an initial observation.
@return initial observation | [
"Reset",
"the",
"state",
"of",
"the",
"environment",
"and",
"return",
"an",
"initial",
"observation",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/gym-java-client/src/main/java/org/deeplearning4j/gym/Client.java#L116-L119 |
128,053 | deeplearning4j/deeplearning4j | gym-java-client/src/main/java/org/deeplearning4j/gym/Client.java | Client.upload | public void upload(String trainingDir, String apiKey, String algorithmId) {
JSONObject json = new JSONObject().put("training_dir", trainingDir).put("api_key", apiKey).put("algorithm_id",
algorithmId);
uploadPost(json);
} | java | public void upload(String trainingDir, String apiKey, String algorithmId) {
JSONObject json = new JSONObject().put("training_dir", trainingDir).put("api_key", apiKey).put("algorithm_id",
algorithmId);
uploadPost(json);
} | [
"public",
"void",
"upload",
"(",
"String",
"trainingDir",
",",
"String",
"apiKey",
",",
"String",
"algorithmId",
")",
"{",
"JSONObject",
"json",
"=",
"new",
"JSONObject",
"(",
")",
".",
"put",
"(",
"\"training_dir\"",
",",
"trainingDir",
")",
".",
"put",
"... | Upload monitoring data to OpenAI servers.
@param trainingDir directory that contains the monitoring data
@param apiKey personal OpenAI API key
@param algorithmId an arbitrary string indicating the paricular version of the algorithm (including choices of parameters) you are running. | [
"Upload",
"monitoring",
"data",
"to",
"OpenAI",
"servers",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/gym-java-client/src/main/java/org/deeplearning4j/gym/Client.java#L163-L168 |
128,054 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasModelUtils.java | KerasModelUtils.copyWeightsToModel | public static Model copyWeightsToModel(Model model, Map<String, KerasLayer> kerasLayers)
throws InvalidKerasConfigurationException {
/* Get list if layers from model. */
Layer[] layersFromModel;
if (model instanceof MultiLayerNetwork)
layersFromModel = ((MultiLayerNetwork... | java | public static Model copyWeightsToModel(Model model, Map<String, KerasLayer> kerasLayers)
throws InvalidKerasConfigurationException {
/* Get list if layers from model. */
Layer[] layersFromModel;
if (model instanceof MultiLayerNetwork)
layersFromModel = ((MultiLayerNetwork... | [
"public",
"static",
"Model",
"copyWeightsToModel",
"(",
"Model",
"model",
",",
"Map",
"<",
"String",
",",
"KerasLayer",
">",
"kerasLayers",
")",
"throws",
"InvalidKerasConfigurationException",
"{",
"/* Get list if layers from model. */",
"Layer",
"[",
"]",
"layersFromMo... | Helper function to import weights from nested Map into existing model. Depends critically
on matched layer and parameter names. In general this seems to be straightforward for most
Keras models and layersOrdered, but there may be edge cases.
@param model DL4J Model interface
@return DL4J Model interface
@throws Invali... | [
"Helper",
"function",
"to",
"import",
"weights",
"from",
"nested",
"Map",
"into",
"existing",
"model",
".",
"Depends",
"critically",
"on",
"matched",
"layer",
"and",
"parameter",
"names",
".",
"In",
"general",
"this",
"seems",
"to",
"be",
"straightforward",
"f... | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasModelUtils.java#L60-L86 |
128,055 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasModelUtils.java | KerasModelUtils.determineKerasMajorVersion | public static int determineKerasMajorVersion(Map<String, Object> modelConfig, KerasModelConfiguration config)
throws InvalidKerasConfigurationException {
int kerasMajorVersion;
if (!modelConfig.containsKey(config.getFieldKerasVersion())) {
log.warn("Could not read keras version u... | java | public static int determineKerasMajorVersion(Map<String, Object> modelConfig, KerasModelConfiguration config)
throws InvalidKerasConfigurationException {
int kerasMajorVersion;
if (!modelConfig.containsKey(config.getFieldKerasVersion())) {
log.warn("Could not read keras version u... | [
"public",
"static",
"int",
"determineKerasMajorVersion",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"modelConfig",
",",
"KerasModelConfiguration",
"config",
")",
"throws",
"InvalidKerasConfigurationException",
"{",
"int",
"kerasMajorVersion",
";",
"if",
"(",
"!",
... | Determine Keras major version
@param modelConfig parsed model configuration for keras model
@param config basic model configuration (KerasModelConfiguration)
@return Major Keras version (1 or 2)
@throws InvalidKerasConfigurationException Invalid Keras config | [
"Determine",
"Keras",
"major",
"version"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasModelUtils.java#L96-L116 |
128,056 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasModelUtils.java | KerasModelUtils.determineKerasBackend | public static String determineKerasBackend(Map<String, Object> modelConfig, KerasModelConfiguration config) {
String kerasBackend = null;
if (!modelConfig.containsKey(config.getFieldBackend())) {
// TODO: H5 files unfortunately do not seem to have this property in keras 1.
log.wa... | java | public static String determineKerasBackend(Map<String, Object> modelConfig, KerasModelConfiguration config) {
String kerasBackend = null;
if (!modelConfig.containsKey(config.getFieldBackend())) {
// TODO: H5 files unfortunately do not seem to have this property in keras 1.
log.wa... | [
"public",
"static",
"String",
"determineKerasBackend",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"modelConfig",
",",
"KerasModelConfiguration",
"config",
")",
"{",
"String",
"kerasBackend",
"=",
"null",
";",
"if",
"(",
"!",
"modelConfig",
".",
"containsKey"... | Determine Keras backend
@param modelConfig parsed model configuration for keras model
@param config basic model configuration (KerasModelConfiguration)
@return Keras backend string
@throws InvalidKerasConfigurationException Invalid Keras config | [
"Determine",
"Keras",
"backend"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasModelUtils.java#L126-L137 |
128,057 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasModelUtils.java | KerasModelUtils.parseModelConfig | public static Map<String, Object> parseModelConfig(String modelJson, String modelYaml)
throws IOException, InvalidKerasConfigurationException {
Map<String, Object> modelConfig;
if (modelJson != null)
modelConfig = parseJsonString(modelJson);
else if (modelYaml != null)
... | java | public static Map<String, Object> parseModelConfig(String modelJson, String modelYaml)
throws IOException, InvalidKerasConfigurationException {
Map<String, Object> modelConfig;
if (modelJson != null)
modelConfig = parseJsonString(modelJson);
else if (modelYaml != null)
... | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"parseModelConfig",
"(",
"String",
"modelJson",
",",
"String",
"modelYaml",
")",
"throws",
"IOException",
",",
"InvalidKerasConfigurationException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"mod... | Parse Keras model configuration from JSON or YAML string representation
@param modelJson JSON string representing model (potentially null)
@param modelYaml YAML string representing model (potentially null)
@return Model configuration as Map<String, Object>
@throws IOException IO exception
@throw... | [
"Parse",
"Keras",
"model",
"configuration",
"from",
"JSON",
"or",
"YAML",
"string",
"representation"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasModelUtils.java#L325-L335 |
128,058 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasModelUtils.java | KerasModelUtils.parseJsonString | public static Map<String, Object> parseJsonString(String json) throws IOException {
ObjectMapper mapper = new ObjectMapper();
TypeReference<HashMap<String, Object>> typeRef = new TypeReference<HashMap<String, Object>>() {
};
return mapper.readValue(json, typeRef);
} | java | public static Map<String, Object> parseJsonString(String json) throws IOException {
ObjectMapper mapper = new ObjectMapper();
TypeReference<HashMap<String, Object>> typeRef = new TypeReference<HashMap<String, Object>>() {
};
return mapper.readValue(json, typeRef);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"parseJsonString",
"(",
"String",
"json",
")",
"throws",
"IOException",
"{",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
")",
";",
"TypeReference",
"<",
"HashMap",
"<",
"String",
",... | Convenience function for parsing JSON strings.
@param json String containing valid JSON
@return Nested (key,value) map of arbitrary depth
@throws IOException IO exception | [
"Convenience",
"function",
"for",
"parsing",
"JSON",
"strings",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasModelUtils.java#L345-L350 |
128,059 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasModelUtils.java | KerasModelUtils.parseYamlString | public static Map<String, Object> parseYamlString(String yaml) throws IOException {
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
TypeReference<HashMap<String, Object>> typeRef = new TypeReference<HashMap<String, Object>>() {
};
return mapper.readValue(yaml, typeRef);
} | java | public static Map<String, Object> parseYamlString(String yaml) throws IOException {
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
TypeReference<HashMap<String, Object>> typeRef = new TypeReference<HashMap<String, Object>>() {
};
return mapper.readValue(yaml, typeRef);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"parseYamlString",
"(",
"String",
"yaml",
")",
"throws",
"IOException",
"{",
"ObjectMapper",
"mapper",
"=",
"new",
"ObjectMapper",
"(",
"new",
"YAMLFactory",
"(",
")",
")",
";",
"TypeReference",
"... | Convenience function for parsing YAML strings.
@param yaml String containing valid YAML
@return Nested (key,value) map of arbitrary depth
@throws IOException IO exception | [
"Convenience",
"function",
"for",
"parsing",
"YAML",
"strings",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasModelUtils.java#L359-L364 |
128,060 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/bagofwords/vectorizer/TfidfVectorizer.java | TfidfVectorizer.vectorize | @Override
public DataSet vectorize(InputStream is, String label) {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
String line = "";
StringBuilder builder = new StringBuilder();
while ((line = reader.readLine()) != null) {... | java | @Override
public DataSet vectorize(InputStream is, String label) {
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
String line = "";
StringBuilder builder = new StringBuilder();
while ((line = reader.readLine()) != null) {... | [
"@",
"Override",
"public",
"DataSet",
"vectorize",
"(",
"InputStream",
"is",
",",
"String",
"label",
")",
"{",
"try",
"{",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"is",
",",
"\"UTF-8\"",
")",
")",
";",
... | Text coming from an input stream considered as one document
@param is the input stream to read from
@param label the label to assign
@return a dataset with a applyTransformToDestination of weights(relative to impl; could be word counts or tfidf scores) | [
"Text",
"coming",
"from",
"an",
"input",
"stream",
"considered",
"as",
"one",
"document"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/bagofwords/vectorizer/TfidfVectorizer.java#L58-L71 |
128,061 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/bagofwords/vectorizer/TfidfVectorizer.java | TfidfVectorizer.vectorize | @Override
public DataSet vectorize(String text, String label) {
INDArray input = transform(text);
INDArray labelMatrix = FeatureUtil.toOutcomeVector(labelsSource.indexOf(label), labelsSource.size());
return new DataSet(input, labelMatrix);
} | java | @Override
public DataSet vectorize(String text, String label) {
INDArray input = transform(text);
INDArray labelMatrix = FeatureUtil.toOutcomeVector(labelsSource.indexOf(label), labelsSource.size());
return new DataSet(input, labelMatrix);
} | [
"@",
"Override",
"public",
"DataSet",
"vectorize",
"(",
"String",
"text",
",",
"String",
"label",
")",
"{",
"INDArray",
"input",
"=",
"transform",
"(",
"text",
")",
";",
"INDArray",
"labelMatrix",
"=",
"FeatureUtil",
".",
"toOutcomeVector",
"(",
"labelsSource"... | Vectorizes the passed in text treating it as one document
@param text the text to vectorize
@param label the label of the text
@return a dataset with a transform of weights(relative to impl; could be word counts or tfidf scores) | [
"Vectorizes",
"the",
"passed",
"in",
"text",
"treating",
"it",
"as",
"one",
"document"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/bagofwords/vectorizer/TfidfVectorizer.java#L80-L86 |
128,062 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/bagofwords/vectorizer/TfidfVectorizer.java | TfidfVectorizer.transform | @Override
public INDArray transform(String text) {
Tokenizer tokenizer = tokenizerFactory.create(text);
List<String> tokens = tokenizer.getTokens();
// build document words count
return transform(tokens);
} | java | @Override
public INDArray transform(String text) {
Tokenizer tokenizer = tokenizerFactory.create(text);
List<String> tokens = tokenizer.getTokens();
// build document words count
return transform(tokens);
} | [
"@",
"Override",
"public",
"INDArray",
"transform",
"(",
"String",
"text",
")",
"{",
"Tokenizer",
"tokenizer",
"=",
"tokenizerFactory",
".",
"create",
"(",
"text",
")",
";",
"List",
"<",
"String",
">",
"tokens",
"=",
"tokenizer",
".",
"getTokens",
"(",
")"... | Transforms the matrix
@param text text to transform
@return {@link INDArray} | [
"Transforms",
"the",
"matrix"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/bagofwords/vectorizer/TfidfVectorizer.java#L110-L117 |
128,063 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/blas/BlasBufferUtil.java | BlasBufferUtil.getDimension | public static int getDimension(INDArray arr, boolean defaultRows) {
// FIXME: int cast
//ignore ordering for vectors
if (arr.isVector()) {
return defaultRows ? (int) arr.rows() : (int) arr.columns();
}
if (arr.ordering() == NDArrayFactory.C)
return defaul... | java | public static int getDimension(INDArray arr, boolean defaultRows) {
// FIXME: int cast
//ignore ordering for vectors
if (arr.isVector()) {
return defaultRows ? (int) arr.rows() : (int) arr.columns();
}
if (arr.ordering() == NDArrayFactory.C)
return defaul... | [
"public",
"static",
"int",
"getDimension",
"(",
"INDArray",
"arr",
",",
"boolean",
"defaultRows",
")",
"{",
"// FIXME: int cast",
"//ignore ordering for vectors",
"if",
"(",
"arr",
".",
"isVector",
"(",
")",
")",
"{",
"return",
"defaultRows",
"?",
"(",
"int",
... | Get the dimension associated with
the given ordering.
When working with blas routines, they typically assume
c ordering, instead you can invert the rows/columns
which enable you to do no copy blas operations.
@param arr
@param defaultRows
@return | [
"Get",
"the",
"dimension",
"associated",
"with",
"the",
"given",
"ordering",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/blas/BlasBufferUtil.java#L145-L155 |
128,064 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/blas/BlasBufferUtil.java | BlasBufferUtil.getLd | public static int getLd(INDArray arr) {
//ignore ordering for vectors
if (arr.isVector()) {
return (int) arr.length();
}
return arr.ordering() == NDArrayFactory.C ? (int) arr.size(1) : (int) arr.size(0);
} | java | public static int getLd(INDArray arr) {
//ignore ordering for vectors
if (arr.isVector()) {
return (int) arr.length();
}
return arr.ordering() == NDArrayFactory.C ? (int) arr.size(1) : (int) arr.size(0);
} | [
"public",
"static",
"int",
"getLd",
"(",
"INDArray",
"arr",
")",
"{",
"//ignore ordering for vectors",
"if",
"(",
"arr",
".",
"isVector",
"(",
")",
")",
"{",
"return",
"(",
"int",
")",
"arr",
".",
"length",
"(",
")",
";",
"}",
"return",
"arr",
".",
"... | Get the leading dimension
for a blas invocation.
The lead dimension is usually
arr.size(0) (this is only for fortran ordering though).
It can be size(1) (assuming matrix) for C ordering though.
@param arr the array to
@return the leading dimension wrt the ordering of the array | [
"Get",
"the",
"leading",
"dimension",
"for",
"a",
"blas",
"invocation",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/blas/BlasBufferUtil.java#L169-L176 |
128,065 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/sequencevectors/serialization/AbstractElementFactory.java | AbstractElementFactory.deserialize | @Override
public T deserialize(String json) {
ObjectMapper mapper = SequenceElement.mapper();
try {
T ret = (T) mapper.readValue(json, targetClass);
return ret;
} catch (IOException e) {
throw new RuntimeException(e);
}
} | java | @Override
public T deserialize(String json) {
ObjectMapper mapper = SequenceElement.mapper();
try {
T ret = (T) mapper.readValue(json, targetClass);
return ret;
} catch (IOException e) {
throw new RuntimeException(e);
}
} | [
"@",
"Override",
"public",
"T",
"deserialize",
"(",
"String",
"json",
")",
"{",
"ObjectMapper",
"mapper",
"=",
"SequenceElement",
".",
"mapper",
"(",
")",
";",
"try",
"{",
"T",
"ret",
"=",
"(",
"T",
")",
"mapper",
".",
"readValue",
"(",
"json",
",",
... | This method builds object from provided JSON
@param json JSON for restored object
@return restored object | [
"This",
"method",
"builds",
"object",
"from",
"provided",
"JSON"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/sequencevectors/serialization/AbstractElementFactory.java#L53-L62 |
128,066 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/sequencevectors/serialization/AbstractElementFactory.java | AbstractElementFactory.serialize | @Override
public String serialize(T element) {
String json = null;
try {
json = element.toJSON();
} catch (Exception e) {
log.error("Direct serialization failed, falling back to jackson");
}
if (json == null || json.isEmpty()) {
ObjectMapp... | java | @Override
public String serialize(T element) {
String json = null;
try {
json = element.toJSON();
} catch (Exception e) {
log.error("Direct serialization failed, falling back to jackson");
}
if (json == null || json.isEmpty()) {
ObjectMapp... | [
"@",
"Override",
"public",
"String",
"serialize",
"(",
"T",
"element",
")",
"{",
"String",
"json",
"=",
"null",
";",
"try",
"{",
"json",
"=",
"element",
".",
"toJSON",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"error... | This method serializaes object into JSON string
@param element
@return | [
"This",
"method",
"serializaes",
"object",
"into",
"JSON",
"string"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/sequencevectors/serialization/AbstractElementFactory.java#L70-L89 |
128,067 | deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/util/ndarray/RecordConverter.java | RecordConverter.toArray | public static INDArray toArray(Collection<? extends Writable> record) {
List<Writable> l;
if(record instanceof List){
l = (List<Writable>)record;
} else {
l = new ArrayList<>(record);
}
//Edge case: single NDArrayWritable
if(l.size() == 1 && l.get... | java | public static INDArray toArray(Collection<? extends Writable> record) {
List<Writable> l;
if(record instanceof List){
l = (List<Writable>)record;
} else {
l = new ArrayList<>(record);
}
//Edge case: single NDArrayWritable
if(l.size() == 1 && l.get... | [
"public",
"static",
"INDArray",
"toArray",
"(",
"Collection",
"<",
"?",
"extends",
"Writable",
">",
"record",
")",
"{",
"List",
"<",
"Writable",
">",
"l",
";",
"if",
"(",
"record",
"instanceof",
"List",
")",
"{",
"l",
"=",
"(",
"List",
"<",
"Writable",... | Convert a record to an INDArray. May contain a mix of Writables and row vector NDArrayWritables.
@param record the record to convert
@return the array | [
"Convert",
"a",
"record",
"to",
"an",
"INDArray",
".",
"May",
"contain",
"a",
"mix",
"of",
"Writables",
"and",
"row",
"vector",
"NDArrayWritables",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/util/ndarray/RecordConverter.java#L98-L143 |
128,068 | deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/util/ndarray/RecordConverter.java | RecordConverter.toRecord | public static List<Writable> toRecord(INDArray array) {
List<Writable> writables = new ArrayList<>();
writables.add(new NDArrayWritable(array));
return writables;
} | java | public static List<Writable> toRecord(INDArray array) {
List<Writable> writables = new ArrayList<>();
writables.add(new NDArrayWritable(array));
return writables;
} | [
"public",
"static",
"List",
"<",
"Writable",
">",
"toRecord",
"(",
"INDArray",
"array",
")",
"{",
"List",
"<",
"Writable",
">",
"writables",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"writables",
".",
"add",
"(",
"new",
"NDArrayWritable",
"(",
"array... | Convert an ndarray to a record
@param array the array to convert
@return the record | [
"Convert",
"an",
"ndarray",
"to",
"a",
"record"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/util/ndarray/RecordConverter.java#L207-L211 |
128,069 | deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/util/ndarray/RecordConverter.java | RecordConverter.toRecords | public static List<List<Writable>> toRecords(DataSet dataSet) {
if (isClassificationDataSet(dataSet)) {
return getClassificationWritableMatrix(dataSet);
} else {
return getRegressionWritableMatrix(dataSet);
}
} | java | public static List<List<Writable>> toRecords(DataSet dataSet) {
if (isClassificationDataSet(dataSet)) {
return getClassificationWritableMatrix(dataSet);
} else {
return getRegressionWritableMatrix(dataSet);
}
} | [
"public",
"static",
"List",
"<",
"List",
"<",
"Writable",
">",
">",
"toRecords",
"(",
"DataSet",
"dataSet",
")",
"{",
"if",
"(",
"isClassificationDataSet",
"(",
"dataSet",
")",
")",
"{",
"return",
"getClassificationWritableMatrix",
"(",
"dataSet",
")",
";",
... | Convert a DataSet to a matrix
@param dataSet the DataSet to convert
@return the matrix for the records | [
"Convert",
"a",
"DataSet",
"to",
"a",
"matrix"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/util/ndarray/RecordConverter.java#L291-L297 |
128,070 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/kdtree/KDTree.java | KDTree.insert | public void insert(INDArray point) {
if (!point.isVector() || point.length() != dims)
throw new IllegalArgumentException("Point must be a vector of length " + dims);
if (root == null) {
root = new KDNode(point);
rect = new HyperRect(HyperRect.point(point));
}... | java | public void insert(INDArray point) {
if (!point.isVector() || point.length() != dims)
throw new IllegalArgumentException("Point must be a vector of length " + dims);
if (root == null) {
root = new KDNode(point);
rect = new HyperRect(HyperRect.point(point));
}... | [
"public",
"void",
"insert",
"(",
"INDArray",
"point",
")",
"{",
"if",
"(",
"!",
"point",
".",
"isVector",
"(",
")",
"||",
"point",
".",
"length",
"(",
")",
"!=",
"dims",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Point must be a vector of lengt... | Insert a point in to the tree
@param point the point to insert | [
"Insert",
"a",
"point",
"in",
"to",
"the",
"tree"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/kdtree/KDTree.java#L53-L96 |
128,071 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/kdtree/KDTree.java | KDTree.nn | public Pair<Double, INDArray> nn(INDArray point) {
return nn(root, point, rect, Double.POSITIVE_INFINITY, null, 0);
} | java | public Pair<Double, INDArray> nn(INDArray point) {
return nn(root, point, rect, Double.POSITIVE_INFINITY, null, 0);
} | [
"public",
"Pair",
"<",
"Double",
",",
"INDArray",
">",
"nn",
"(",
"INDArray",
"point",
")",
"{",
"return",
"nn",
"(",
"root",
",",
"point",
",",
"rect",
",",
"Double",
".",
"POSITIVE_INFINITY",
",",
"null",
",",
"0",
")",
";",
"}"
] | Query for nearest neighbor. Returns the distance and point
@param point the point to query for
@return | [
"Query",
"for",
"nearest",
"neighbor",
".",
"Returns",
"the",
"distance",
"and",
"point"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/kdtree/KDTree.java#L167-L169 |
128,072 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/deeplearning4j-aws/src/main/java/org/deeplearning4j/aws/s3/uploader/S3Uploader.java | S3Uploader.multiPartUpload | public void multiPartUpload(File file, String bucketName) {
AmazonS3 client = new AmazonS3Client(creds);
bucketName = ensureValidBucketName(bucketName);
List<Bucket> buckets = client.listBuckets();
for (Bucket b : buckets)
if (b.getName().equals(bucketName)) {
... | java | public void multiPartUpload(File file, String bucketName) {
AmazonS3 client = new AmazonS3Client(creds);
bucketName = ensureValidBucketName(bucketName);
List<Bucket> buckets = client.listBuckets();
for (Bucket b : buckets)
if (b.getName().equals(bucketName)) {
... | [
"public",
"void",
"multiPartUpload",
"(",
"File",
"file",
",",
"String",
"bucketName",
")",
"{",
"AmazonS3",
"client",
"=",
"new",
"AmazonS3Client",
"(",
"creds",
")",
";",
"bucketName",
"=",
"ensureValidBucketName",
"(",
"bucketName",
")",
";",
"List",
"<",
... | Multi part upload for big files
@param file the file to upload
@param bucketName the bucket name to upload | [
"Multi",
"part",
"upload",
"for",
"big",
"files"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/deeplearning4j-aws/src/main/java/org/deeplearning4j/aws/s3/uploader/S3Uploader.java#L45-L59 |
128,073 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java | ComputationGraph.setCacheMode | public void setCacheMode(CacheMode mode) {
if (mode == null)
mode = CacheMode.NONE;
for (Layer layer : layers) {
layer.setCacheMode(mode);
}
} | java | public void setCacheMode(CacheMode mode) {
if (mode == null)
mode = CacheMode.NONE;
for (Layer layer : layers) {
layer.setCacheMode(mode);
}
} | [
"public",
"void",
"setCacheMode",
"(",
"CacheMode",
"mode",
")",
"{",
"if",
"(",
"mode",
"==",
"null",
")",
"mode",
"=",
"CacheMode",
".",
"NONE",
";",
"for",
"(",
"Layer",
"layer",
":",
"layers",
")",
"{",
"layer",
".",
"setCacheMode",
"(",
"mode",
... | This method sets specified CacheMode for all layers within network
@param mode | [
"This",
"method",
"sets",
"specified",
"CacheMode",
"for",
"all",
"layers",
"within",
"network"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L274-L281 |
128,074 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java | ComputationGraph.getLayer | public Layer getLayer(String name) {
Preconditions.checkState(verticesMap.containsKey(name), "Layer with name %s does not exist in the network", name);
return verticesMap.get(name).getLayer();
} | java | public Layer getLayer(String name) {
Preconditions.checkState(verticesMap.containsKey(name), "Layer with name %s does not exist in the network", name);
return verticesMap.get(name).getLayer();
} | [
"public",
"Layer",
"getLayer",
"(",
"String",
"name",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"verticesMap",
".",
"containsKey",
"(",
"name",
")",
",",
"\"Layer with name %s does not exist in the network\"",
",",
"name",
")",
";",
"return",
"verticesMap",... | Get a given layer by name. | [
"Get",
"a",
"given",
"layer",
"by",
"name",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L317-L320 |
128,075 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java | ComputationGraph.setInput | public void setInput(int inputNum, INDArray input) {
if (inputs == null) {
//May be null after clear()
inputs = new INDArray[numInputArrays];
}
inputs[inputNum] = input;
} | java | public void setInput(int inputNum, INDArray input) {
if (inputs == null) {
//May be null after clear()
inputs = new INDArray[numInputArrays];
}
inputs[inputNum] = input;
} | [
"public",
"void",
"setInput",
"(",
"int",
"inputNum",
",",
"INDArray",
"input",
")",
"{",
"if",
"(",
"inputs",
"==",
"null",
")",
"{",
"//May be null after clear()",
"inputs",
"=",
"new",
"INDArray",
"[",
"numInputArrays",
"]",
";",
"}",
"inputs",
"[",
"in... | Set the specified input for the ComputationGraph | [
"Set",
"the",
"specified",
"input",
"for",
"the",
"ComputationGraph"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L353-L359 |
128,076 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java | ComputationGraph.setInputs | public void setInputs(INDArray... inputs) {
if (inputs != null && inputs.length != this.numInputArrays) {
throw new IllegalArgumentException("Invalid input array: network has " + numInputArrays
+ " inputs, but array is of length " + inputs.length);
}
this.inputs =... | java | public void setInputs(INDArray... inputs) {
if (inputs != null && inputs.length != this.numInputArrays) {
throw new IllegalArgumentException("Invalid input array: network has " + numInputArrays
+ " inputs, but array is of length " + inputs.length);
}
this.inputs =... | [
"public",
"void",
"setInputs",
"(",
"INDArray",
"...",
"inputs",
")",
"{",
"if",
"(",
"inputs",
"!=",
"null",
"&&",
"inputs",
".",
"length",
"!=",
"this",
".",
"numInputArrays",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid input array:... | Set all inputs for the ComputationGraph network | [
"Set",
"all",
"inputs",
"for",
"the",
"ComputationGraph",
"network"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L364-L370 |
128,077 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java | ComputationGraph.setLabels | public void setLabels(INDArray... labels) {
if (labels != null && labels.length != this.numOutputArrays) {
throw new IllegalArgumentException("Invalid output array: network has " + numOutputArrays
+ " outputs, but array is of length " + labels.length);
}
this.labe... | java | public void setLabels(INDArray... labels) {
if (labels != null && labels.length != this.numOutputArrays) {
throw new IllegalArgumentException("Invalid output array: network has " + numOutputArrays
+ " outputs, but array is of length " + labels.length);
}
this.labe... | [
"public",
"void",
"setLabels",
"(",
"INDArray",
"...",
"labels",
")",
"{",
"if",
"(",
"labels",
"!=",
"null",
"&&",
"labels",
".",
"length",
"!=",
"this",
".",
"numOutputArrays",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid output arra... | Set all labels for the ComputationGraph network | [
"Set",
"all",
"labels",
"for",
"the",
"ComputationGraph",
"network"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L412-L418 |
128,078 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java | ComputationGraph.pretrainLayer | public void pretrainLayer(String layerName, DataSetIterator dataSetIterator) {
if (numInputArrays != 1) {
throw new UnsupportedOperationException(
"Cannot train ComputationGraph network with multiple inputs using a DataSetIterator");
}
pretrainLayer(layerName, C... | java | public void pretrainLayer(String layerName, DataSetIterator dataSetIterator) {
if (numInputArrays != 1) {
throw new UnsupportedOperationException(
"Cannot train ComputationGraph network with multiple inputs using a DataSetIterator");
}
pretrainLayer(layerName, C... | [
"public",
"void",
"pretrainLayer",
"(",
"String",
"layerName",
",",
"DataSetIterator",
"dataSetIterator",
")",
"{",
"if",
"(",
"numInputArrays",
"!=",
"1",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Cannot train ComputationGraph network with multi... | Pretrain a specified layer with the given DataSetIterator
@param layerName Layer name
@param dataSetIterator Data | [
"Pretrain",
"a",
"specified",
"layer",
"with",
"the",
"given",
"DataSetIterator"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L879-L886 |
128,079 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java | ComputationGraph.pretrainLayer | public void pretrainLayer(String layerName, MultiDataSetIterator iter) {
try{
pretrainLayerHelper(layerName, iter, 1);
} catch (OutOfMemoryError e){
CrashReportingUtil.writeMemoryCrashDump(this, e);
throw e;
}
} | java | public void pretrainLayer(String layerName, MultiDataSetIterator iter) {
try{
pretrainLayerHelper(layerName, iter, 1);
} catch (OutOfMemoryError e){
CrashReportingUtil.writeMemoryCrashDump(this, e);
throw e;
}
} | [
"public",
"void",
"pretrainLayer",
"(",
"String",
"layerName",
",",
"MultiDataSetIterator",
"iter",
")",
"{",
"try",
"{",
"pretrainLayerHelper",
"(",
"layerName",
",",
"iter",
",",
"1",
")",
";",
"}",
"catch",
"(",
"OutOfMemoryError",
"e",
")",
"{",
"CrashRe... | Pretrain a specified layer with the given MultiDataSetIterator
@param layerName Layer name
@param iter Training data | [
"Pretrain",
"a",
"specified",
"layer",
"with",
"the",
"given",
"MultiDataSetIterator"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L894-L901 |
128,080 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java | ComputationGraph.fit | public void fit(MultiDataSet multiDataSet) {
fit(multiDataSet.getFeatures(), multiDataSet.getLabels(), multiDataSet.getFeaturesMaskArrays(),
multiDataSet.getLabelsMaskArrays());
if (multiDataSet.hasMaskArrays())
clearLayerMaskArrays();
} | java | public void fit(MultiDataSet multiDataSet) {
fit(multiDataSet.getFeatures(), multiDataSet.getLabels(), multiDataSet.getFeaturesMaskArrays(),
multiDataSet.getLabelsMaskArrays());
if (multiDataSet.hasMaskArrays())
clearLayerMaskArrays();
} | [
"public",
"void",
"fit",
"(",
"MultiDataSet",
"multiDataSet",
")",
"{",
"fit",
"(",
"multiDataSet",
".",
"getFeatures",
"(",
")",
",",
"multiDataSet",
".",
"getLabels",
"(",
")",
",",
"multiDataSet",
".",
"getFeaturesMaskArrays",
"(",
")",
",",
"multiDataSet",... | Fit the ComputationGraph using a MultiDataSet | [
"Fit",
"the",
"ComputationGraph",
"using",
"a",
"MultiDataSet"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L1021-L1026 |
128,081 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java | ComputationGraph.fit | public void fit(INDArray[] inputs, INDArray[] labels) {
fit(inputs, labels, null, null);
} | java | public void fit(INDArray[] inputs, INDArray[] labels) {
fit(inputs, labels, null, null);
} | [
"public",
"void",
"fit",
"(",
"INDArray",
"[",
"]",
"inputs",
",",
"INDArray",
"[",
"]",
"labels",
")",
"{",
"fit",
"(",
"inputs",
",",
"labels",
",",
"null",
",",
"null",
")",
";",
"}"
] | Fit the ComputationGraph given arrays of inputs and labels.
@param inputs The network inptus
@param labels The labels | [
"Fit",
"the",
"ComputationGraph",
"given",
"arrays",
"of",
"inputs",
"and",
"labels",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L1098-L1100 |
128,082 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java | ComputationGraph.feedForward | public Map<String, INDArray> feedForward(INDArray input, boolean train) {
if (numInputArrays != 1)
throw new UnsupportedOperationException("Cannot feedForward with single input for graph network with "
+ numInputArrays + " expected inputs");
setInput(0, input);
re... | java | public Map<String, INDArray> feedForward(INDArray input, boolean train) {
if (numInputArrays != 1)
throw new UnsupportedOperationException("Cannot feedForward with single input for graph network with "
+ numInputArrays + " expected inputs");
setInput(0, input);
re... | [
"public",
"Map",
"<",
"String",
",",
"INDArray",
">",
"feedForward",
"(",
"INDArray",
"input",
",",
"boolean",
"train",
")",
"{",
"if",
"(",
"numInputArrays",
"!=",
"1",
")",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Cannot feedForward with single i... | Conduct forward pass using a single input array. Note that this method can only be used with ComputationGraphs
with a single input array.
@param input The input array
@param train If true: do forward pass at training time
@return A map of activations for each layer (not each GraphVertex). Keys = layer name, values = l... | [
"Conduct",
"forward",
"pass",
"using",
"a",
"single",
"input",
"array",
".",
"Note",
"that",
"this",
"method",
"can",
"only",
"be",
"used",
"with",
"ComputationGraphs",
"with",
"a",
"single",
"input",
"array",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L1515-L1521 |
128,083 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java | ComputationGraph.output | public INDArray[] output(List<String> layers, boolean train, INDArray[] features, INDArray[] featureMasks){
Preconditions.checkState(layers != null && layers.size() > 0, "Layers must not be null: got later names %s", layers);
int[] layerNums = new int[layers.size()];
for( int i=0; i<layers.size(... | java | public INDArray[] output(List<String> layers, boolean train, INDArray[] features, INDArray[] featureMasks){
Preconditions.checkState(layers != null && layers.size() > 0, "Layers must not be null: got later names %s", layers);
int[] layerNums = new int[layers.size()];
for( int i=0; i<layers.size(... | [
"public",
"INDArray",
"[",
"]",
"output",
"(",
"List",
"<",
"String",
">",
"layers",
",",
"boolean",
"train",
",",
"INDArray",
"[",
"]",
"features",
",",
"INDArray",
"[",
"]",
"featureMasks",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"layers",
"... | Get the activations for the specific layers only
@param layers Layers to get the specified activations for
@param train If true: train mode. False: test (inference) mode
@param features Features array
@param featureMasks Feature masks array. May be null
@return Activations of the selected layers, in th... | [
"Get",
"the",
"activations",
"for",
"the",
"specific",
"layers",
"only"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L1859-L1870 |
128,084 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java | ComputationGraph.backpropGradient | public Gradient backpropGradient(INDArray... epsilons) {
if (epsilons == null || epsilons.length != numOutputArrays)
throw new IllegalArgumentException(
"Invalid input: must have epsilons length equal to number of output arrays");
try {
calcBackpropGradients... | java | public Gradient backpropGradient(INDArray... epsilons) {
if (epsilons == null || epsilons.length != numOutputArrays)
throw new IllegalArgumentException(
"Invalid input: must have epsilons length equal to number of output arrays");
try {
calcBackpropGradients... | [
"public",
"Gradient",
"backpropGradient",
"(",
"INDArray",
"...",
"epsilons",
")",
"{",
"if",
"(",
"epsilons",
"==",
"null",
"||",
"epsilons",
".",
"length",
"!=",
"numOutputArrays",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid input: must have e... | Calculate the gradient of the network with respect to some external errors.
Note that this is typically used for things like reinforcement learning, not typical networks that include
an OutputLayer or RnnOutputLayer
@param epsilons Epsilons (errors) at the output. Same order with which the output layers are defined in... | [
"Calculate",
"the",
"gradient",
"of",
"the",
"network",
"with",
"respect",
"to",
"some",
"external",
"errors",
".",
"Note",
"that",
"this",
"is",
"typically",
"used",
"for",
"things",
"like",
"reinforcement",
"learning",
"not",
"typical",
"networks",
"that",
"... | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L2458-L2471 |
128,085 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java | ComputationGraph.getUpdater | public ComputationGraphUpdater getUpdater(boolean initializeIfAbsent){
if (solver == null && initializeIfAbsent) {
solver = new Solver.Builder().configure(conf()).listeners(getListeners()).model(this).build();
solver.getOptimizer().setUpdaterComputationGraph(new ComputationGraphUpdater(t... | java | public ComputationGraphUpdater getUpdater(boolean initializeIfAbsent){
if (solver == null && initializeIfAbsent) {
solver = new Solver.Builder().configure(conf()).listeners(getListeners()).model(this).build();
solver.getOptimizer().setUpdaterComputationGraph(new ComputationGraphUpdater(t... | [
"public",
"ComputationGraphUpdater",
"getUpdater",
"(",
"boolean",
"initializeIfAbsent",
")",
"{",
"if",
"(",
"solver",
"==",
"null",
"&&",
"initializeIfAbsent",
")",
"{",
"solver",
"=",
"new",
"Solver",
".",
"Builder",
"(",
")",
".",
"configure",
"(",
"conf",... | Get the ComputationGraphUpdater for this network
@param initializeIfAbsent If true: create the updater if one is absent. False: return null if absent.
@return Updater | [
"Get",
"the",
"ComputationGraphUpdater",
"for",
"this",
"network"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L2860-L2869 |
128,086 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java | ComputationGraph.setUpdater | public void setUpdater(ComputationGraphUpdater updater) {
if (solver == null) {
solver = new Solver.Builder().configure(conf()).listeners(getListeners()).model(this).build();
}
solver.getOptimizer().setUpdaterComputationGraph(updater);
} | java | public void setUpdater(ComputationGraphUpdater updater) {
if (solver == null) {
solver = new Solver.Builder().configure(conf()).listeners(getListeners()).model(this).build();
}
solver.getOptimizer().setUpdaterComputationGraph(updater);
} | [
"public",
"void",
"setUpdater",
"(",
"ComputationGraphUpdater",
"updater",
")",
"{",
"if",
"(",
"solver",
"==",
"null",
")",
"{",
"solver",
"=",
"new",
"Solver",
".",
"Builder",
"(",
")",
".",
"configure",
"(",
"conf",
"(",
")",
")",
".",
"listeners",
... | Set the computationGraphUpdater for the network | [
"Set",
"the",
"computationGraphUpdater",
"for",
"the",
"network"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L2874-L2879 |
128,087 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java | ComputationGraph.params | public INDArray params(boolean backwardOnly) {
if (backwardOnly)
return flattenedParams;
List<INDArray> list = new ArrayList<>(layers.length);
for (int i = 0; i < topologicalOrder.length; i++) {
if (!vertices[topologicalOrder[i]].hasLayer())
continue;
... | java | public INDArray params(boolean backwardOnly) {
if (backwardOnly)
return flattenedParams;
List<INDArray> list = new ArrayList<>(layers.length);
for (int i = 0; i < topologicalOrder.length; i++) {
if (!vertices[topologicalOrder[i]].hasLayer())
continue;
... | [
"public",
"INDArray",
"params",
"(",
"boolean",
"backwardOnly",
")",
"{",
"if",
"(",
"backwardOnly",
")",
"return",
"flattenedParams",
";",
"List",
"<",
"INDArray",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
"layers",
".",
"length",
")",
";",
"for",
... | Get the parameters for the ComputationGraph
@param backwardOnly If true: backprop parameters only (i.e., no visible layer biases used in layerwise pretraining layers) | [
"Get",
"the",
"parameters",
"for",
"the",
"ComputationGraph"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L2897-L2913 |
128,088 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java | ComputationGraph.doTruncatedBPTT | protected void doTruncatedBPTT(INDArray[] inputs, INDArray[] labels, INDArray[] featureMasks,
INDArray[] labelMasks, LayerWorkspaceMgr workspaceMgr) {
if (flattenedGradients == null) {
initGradientsView();
}
//Approach used here to implement trunca... | java | protected void doTruncatedBPTT(INDArray[] inputs, INDArray[] labels, INDArray[] featureMasks,
INDArray[] labelMasks, LayerWorkspaceMgr workspaceMgr) {
if (flattenedGradients == null) {
initGradientsView();
}
//Approach used here to implement trunca... | [
"protected",
"void",
"doTruncatedBPTT",
"(",
"INDArray",
"[",
"]",
"inputs",
",",
"INDArray",
"[",
"]",
"labels",
",",
"INDArray",
"[",
"]",
"featureMasks",
",",
"INDArray",
"[",
"]",
"labelMasks",
",",
"LayerWorkspaceMgr",
"workspaceMgr",
")",
"{",
"if",
"(... | Fit the network using truncated BPTT | [
"Fit",
"the",
"network",
"using",
"truncated",
"BPTT"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L3557-L3622 |
128,089 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java | ComputationGraph.rnnUpdateStateWithTBPTTState | protected void rnnUpdateStateWithTBPTTState() {
for (int i = 0; i < layers.length; i++) {
if (layers[i] instanceof RecurrentLayer) {
RecurrentLayer l = ((RecurrentLayer) layers[i]);
l.rnnSetPreviousState(l.rnnGetTBPTTState());
} else if (layers[i] instance... | java | protected void rnnUpdateStateWithTBPTTState() {
for (int i = 0; i < layers.length; i++) {
if (layers[i] instanceof RecurrentLayer) {
RecurrentLayer l = ((RecurrentLayer) layers[i]);
l.rnnSetPreviousState(l.rnnGetTBPTTState());
} else if (layers[i] instance... | [
"protected",
"void",
"rnnUpdateStateWithTBPTTState",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"layers",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"layers",
"[",
"i",
"]",
"instanceof",
"RecurrentLayer",
")",
"{",
"Rec... | Update the internal state of RNN layers after a truncated BPTT fit call | [
"Update",
"the",
"internal",
"state",
"of",
"RNN",
"layers",
"after",
"a",
"truncated",
"BPTT",
"fit",
"call"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L3785-L3794 |
128,090 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java | ComputationGraph.clearLayersStates | public void clearLayersStates() {
for (Layer layer : layers) {
layer.clear();
layer.clearNoiseWeightParams();
}
for (GraphVertex vertex : vertices) {
vertex.clearVertex();
}
} | java | public void clearLayersStates() {
for (Layer layer : layers) {
layer.clear();
layer.clearNoiseWeightParams();
}
for (GraphVertex vertex : vertices) {
vertex.clearVertex();
}
} | [
"public",
"void",
"clearLayersStates",
"(",
")",
"{",
"for",
"(",
"Layer",
"layer",
":",
"layers",
")",
"{",
"layer",
".",
"clear",
"(",
")",
";",
"layer",
".",
"clearNoiseWeightParams",
"(",
")",
";",
"}",
"for",
"(",
"GraphVertex",
"vertex",
":",
"ve... | This method just makes sure there's no state preserved within layers | [
"This",
"method",
"just",
"makes",
"sure",
"there",
"s",
"no",
"state",
"preserved",
"within",
"layers"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L4403-L4412 |
128,091 | deeplearning4j/deeplearning4j | arbiter/arbiter-core/src/main/java/org/deeplearning4j/arbiter/util/CollectionUtils.java | CollectionUtils.countUnique | public static int countUnique(Collection<?> collection) {
HashSet<Object> set = new HashSet<>(collection);
return set.size();
} | java | public static int countUnique(Collection<?> collection) {
HashSet<Object> set = new HashSet<>(collection);
return set.size();
} | [
"public",
"static",
"int",
"countUnique",
"(",
"Collection",
"<",
"?",
">",
"collection",
")",
"{",
"HashSet",
"<",
"Object",
">",
"set",
"=",
"new",
"HashSet",
"<>",
"(",
"collection",
")",
";",
"return",
"set",
".",
"size",
"(",
")",
";",
"}"
] | Count the number of unique values in a collection | [
"Count",
"the",
"number",
"of",
"unique",
"values",
"in",
"a",
"collection"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/arbiter/arbiter-core/src/main/java/org/deeplearning4j/arbiter/util/CollectionUtils.java#L29-L32 |
128,092 | deeplearning4j/deeplearning4j | arbiter/arbiter-core/src/main/java/org/deeplearning4j/arbiter/util/CollectionUtils.java | CollectionUtils.getUnique | public static <T> List<T> getUnique(Collection<T> collection) {
HashSet<T> set = new HashSet<>();
List<T> out = new ArrayList<>();
for (T t : collection) {
if (!set.contains(t)) {
out.add(t);
set.add(t);
}
}
return out;
... | java | public static <T> List<T> getUnique(Collection<T> collection) {
HashSet<T> set = new HashSet<>();
List<T> out = new ArrayList<>();
for (T t : collection) {
if (!set.contains(t)) {
out.add(t);
set.add(t);
}
}
return out;
... | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"getUnique",
"(",
"Collection",
"<",
"T",
">",
"collection",
")",
"{",
"HashSet",
"<",
"T",
">",
"set",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"List",
"<",
"T",
">",
"out",
"=",
"ne... | Returns a list containing only unique values in a collection | [
"Returns",
"a",
"list",
"containing",
"only",
"unique",
"values",
"in",
"a",
"collection"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/arbiter/arbiter-core/src/main/java/org/deeplearning4j/arbiter/util/CollectionUtils.java#L37-L47 |
128,093 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/BaseLayer.java | BaseLayer.numParams | @Override
public long numParams() {
int ret = 0;
for (INDArray val : params.values())
ret += val.length();
return ret;
} | java | @Override
public long numParams() {
int ret = 0;
for (INDArray val : params.values())
ret += val.length();
return ret;
} | [
"@",
"Override",
"public",
"long",
"numParams",
"(",
")",
"{",
"int",
"ret",
"=",
"0",
";",
"for",
"(",
"INDArray",
"val",
":",
"params",
".",
"values",
"(",
")",
")",
"ret",
"+=",
"val",
".",
"length",
"(",
")",
";",
"return",
"ret",
";",
"}"
] | The number of parameters for the model
@return the number of parameters for the model | [
"The",
"number",
"of",
"parameters",
"for",
"the",
"model"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/BaseLayer.java#L386-L392 |
128,094 | deeplearning4j/deeplearning4j | arbiter/arbiter-core/src/main/java/org/deeplearning4j/arbiter/optimize/generator/genetic/population/PopulationModel.java | PopulationModel.add | public void add(Chromosome element) {
if (population.size() == populationSize) {
cullOperator.cullPopulation();
}
population.add(element);
Collections.sort(population, chromosomeComparator);
triggerPopulationChangedListeners(population);
} | java | public void add(Chromosome element) {
if (population.size() == populationSize) {
cullOperator.cullPopulation();
}
population.add(element);
Collections.sort(population, chromosomeComparator);
triggerPopulationChangedListeners(population);
} | [
"public",
"void",
"add",
"(",
"Chromosome",
"element",
")",
"{",
"if",
"(",
"population",
".",
"size",
"(",
")",
"==",
"populationSize",
")",
"{",
"cullOperator",
".",
"cullPopulation",
"(",
")",
";",
"}",
"population",
".",
"add",
"(",
"element",
")",
... | Add a Chromosome to the population and call the PopulationListeners. Culling may be triggered.
@param element The chromosome to be added | [
"Add",
"a",
"Chromosome",
"to",
"the",
"population",
"and",
"call",
"the",
"PopulationListeners",
".",
"Culling",
"may",
"be",
"triggered",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/arbiter/arbiter-core/src/main/java/org/deeplearning4j/arbiter/optimize/generator/genetic/population/PopulationModel.java#L154-L164 |
128,095 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/Hdf5Archive.java | Hdf5Archive.readDataSet | public INDArray readDataSet(String datasetName, String... groups) throws UnsupportedKerasConfigurationException {
synchronized (Hdf5Archive.LOCK_OBJECT) {
if (groups.length == 0)
return readDataSet(this.file, datasetName);
Group[] groupArray = openGroups(groups);
... | java | public INDArray readDataSet(String datasetName, String... groups) throws UnsupportedKerasConfigurationException {
synchronized (Hdf5Archive.LOCK_OBJECT) {
if (groups.length == 0)
return readDataSet(this.file, datasetName);
Group[] groupArray = openGroups(groups);
... | [
"public",
"INDArray",
"readDataSet",
"(",
"String",
"datasetName",
",",
"String",
"...",
"groups",
")",
"throws",
"UnsupportedKerasConfigurationException",
"{",
"synchronized",
"(",
"Hdf5Archive",
".",
"LOCK_OBJECT",
")",
"{",
"if",
"(",
"groups",
".",
"length",
"... | Read data set as ND4J array from group path.
@param datasetName Name of data set
@param groups Array of zero or more ancestor groups from root to parent.
@return INDArray of HDF5 group data
@throws UnsupportedKerasConfigurationException Unsupported Keras config | [
"Read",
"data",
"set",
"as",
"ND4J",
"array",
"from",
"group",
"path",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/Hdf5Archive.java#L107-L116 |
128,096 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/Hdf5Archive.java | Hdf5Archive.readAttributeAsJson | public String readAttributeAsJson(String attributeName, String... groups)
throws UnsupportedKerasConfigurationException {
synchronized (Hdf5Archive.LOCK_OBJECT) {
if (groups.length == 0) {
Attribute a = this.file.openAttribute(attributeName);
String s = re... | java | public String readAttributeAsJson(String attributeName, String... groups)
throws UnsupportedKerasConfigurationException {
synchronized (Hdf5Archive.LOCK_OBJECT) {
if (groups.length == 0) {
Attribute a = this.file.openAttribute(attributeName);
String s = re... | [
"public",
"String",
"readAttributeAsJson",
"(",
"String",
"attributeName",
",",
"String",
"...",
"groups",
")",
"throws",
"UnsupportedKerasConfigurationException",
"{",
"synchronized",
"(",
"Hdf5Archive",
".",
"LOCK_OBJECT",
")",
"{",
"if",
"(",
"groups",
".",
"leng... | Read JSON-formatted string attribute from group path.
@param attributeName Name of attribute
@param groups Array of zero or more ancestor groups from root to parent.
@return HDF5 attribute as JSON
@throws UnsupportedKerasConfigurationException Unsupported Keras config | [
"Read",
"JSON",
"-",
"formatted",
"string",
"attribute",
"from",
"group",
"path",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/Hdf5Archive.java#L126-L142 |
128,097 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/Hdf5Archive.java | Hdf5Archive.hasAttribute | public boolean hasAttribute(String attributeName, String... groups) {
synchronized (Hdf5Archive.LOCK_OBJECT) {
if (groups.length == 0)
return this.file.attrExists(attributeName);
Group[] groupArray = openGroups(groups);
boolean b = groupArray[groupArray.length... | java | public boolean hasAttribute(String attributeName, String... groups) {
synchronized (Hdf5Archive.LOCK_OBJECT) {
if (groups.length == 0)
return this.file.attrExists(attributeName);
Group[] groupArray = openGroups(groups);
boolean b = groupArray[groupArray.length... | [
"public",
"boolean",
"hasAttribute",
"(",
"String",
"attributeName",
",",
"String",
"...",
"groups",
")",
"{",
"synchronized",
"(",
"Hdf5Archive",
".",
"LOCK_OBJECT",
")",
"{",
"if",
"(",
"groups",
".",
"length",
"==",
"0",
")",
"return",
"this",
".",
"fil... | Check whether group path contains string attribute.
@param attributeName Name of attribute
@param groups Array of zero or more ancestor groups from root to parent.
@return Boolean indicating whether attribute exists in group path. | [
"Check",
"whether",
"group",
"path",
"contains",
"string",
"attribute",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/Hdf5Archive.java#L177-L186 |
128,098 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/Hdf5Archive.java | Hdf5Archive.getDataSets | public List<String> getDataSets(String... groups) {
synchronized (Hdf5Archive.LOCK_OBJECT) {
if (groups.length == 0)
return getObjects(this.file, H5O_TYPE_DATASET);
Group[] groupArray = openGroups(groups);
List<String> ls = getObjects(groupArray[groupArray.len... | java | public List<String> getDataSets(String... groups) {
synchronized (Hdf5Archive.LOCK_OBJECT) {
if (groups.length == 0)
return getObjects(this.file, H5O_TYPE_DATASET);
Group[] groupArray = openGroups(groups);
List<String> ls = getObjects(groupArray[groupArray.len... | [
"public",
"List",
"<",
"String",
">",
"getDataSets",
"(",
"String",
"...",
"groups",
")",
"{",
"synchronized",
"(",
"Hdf5Archive",
".",
"LOCK_OBJECT",
")",
"{",
"if",
"(",
"groups",
".",
"length",
"==",
"0",
")",
"return",
"getObjects",
"(",
"this",
".",... | Get list of data sets from group path.
@param groups Array of zero or more ancestor groups from root to parent.
@return List of HDF5 data set names | [
"Get",
"list",
"of",
"data",
"sets",
"from",
"group",
"path",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/Hdf5Archive.java#L194-L203 |
128,099 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/Hdf5Archive.java | Hdf5Archive.getGroups | public List<String> getGroups(String... groups) {
synchronized (Hdf5Archive.LOCK_OBJECT) {
if (groups.length == 0)
return getObjects(this.file, H5O_TYPE_GROUP);
Group[] groupArray = openGroups(groups);
List<String> ls = getObjects(groupArray[groupArray.length ... | java | public List<String> getGroups(String... groups) {
synchronized (Hdf5Archive.LOCK_OBJECT) {
if (groups.length == 0)
return getObjects(this.file, H5O_TYPE_GROUP);
Group[] groupArray = openGroups(groups);
List<String> ls = getObjects(groupArray[groupArray.length ... | [
"public",
"List",
"<",
"String",
">",
"getGroups",
"(",
"String",
"...",
"groups",
")",
"{",
"synchronized",
"(",
"Hdf5Archive",
".",
"LOCK_OBJECT",
")",
"{",
"if",
"(",
"groups",
".",
"length",
"==",
"0",
")",
"return",
"getObjects",
"(",
"this",
".",
... | Get list of groups from group path.
@param groups Array of zero or more ancestor groups from root to parent.
@return List of HDF5 groups | [
"Get",
"list",
"of",
"groups",
"from",
"group",
"path",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/Hdf5Archive.java#L211-L220 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.