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,500 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/vertex/impl/rnn/ReverseTimeSeriesVertex.java | ReverseTimeSeriesVertex.getMask | private INDArray getMask() {
// If no input is provided, no mask is used and null is returned
if (inputIdx < 0) {
return null;
}
final INDArray[] inputMaskArrays = graph.getInputMaskArrays();
return (inputMaskArrays != null ? inputMaskArrays[inputIdx] : null);
} | java | private INDArray getMask() {
// If no input is provided, no mask is used and null is returned
if (inputIdx < 0) {
return null;
}
final INDArray[] inputMaskArrays = graph.getInputMaskArrays();
return (inputMaskArrays != null ? inputMaskArrays[inputIdx] : null);
} | [
"private",
"INDArray",
"getMask",
"(",
")",
"{",
"// If no input is provided, no mask is used and null is returned",
"if",
"(",
"inputIdx",
"<",
"0",
")",
"{",
"return",
"null",
";",
"}",
"final",
"INDArray",
"[",
"]",
"inputMaskArrays",
"=",
"graph",
".",
"getInp... | Gets the current mask array from the provided input
@return The mask or null, if no input was provided | [
"Gets",
"the",
"current",
"mask",
"array",
"from",
"the",
"provided",
"input"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/vertex/impl/rnn/ReverseTimeSeriesVertex.java#L110-L118 |
128,501 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/paragraphvectors/ParagraphVectors.java | ParagraphVectors.inferVector | public INDArray inferVector(String text, double learningRate, double minLearningRate, int iterations) {
if (tokenizerFactory == null)
throw new IllegalStateException("TokenizerFactory should be defined, prior to predict() call");
if (this.vocab == null || this.vocab.numWords() == 0)
... | java | public INDArray inferVector(String text, double learningRate, double minLearningRate, int iterations) {
if (tokenizerFactory == null)
throw new IllegalStateException("TokenizerFactory should be defined, prior to predict() call");
if (this.vocab == null || this.vocab.numWords() == 0)
... | [
"public",
"INDArray",
"inferVector",
"(",
"String",
"text",
",",
"double",
"learningRate",
",",
"double",
"minLearningRate",
",",
"int",
"iterations",
")",
"{",
"if",
"(",
"tokenizerFactory",
"==",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"To... | This method calculates inferred vector for given text
@param text
@return | [
"This",
"method",
"calculates",
"inferred",
"vector",
"for",
"given",
"text"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/paragraphvectors/ParagraphVectors.java#L196-L215 |
128,502 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/paragraphvectors/ParagraphVectors.java | ParagraphVectors.inferVector | public INDArray inferVector(String text) {
return inferVector(text, this.learningRate.get(), this.minLearningRate, this.numEpochs * this.numIterations);
} | java | public INDArray inferVector(String text) {
return inferVector(text, this.learningRate.get(), this.minLearningRate, this.numEpochs * this.numIterations);
} | [
"public",
"INDArray",
"inferVector",
"(",
"String",
"text",
")",
"{",
"return",
"inferVector",
"(",
"text",
",",
"this",
".",
"learningRate",
".",
"get",
"(",
")",
",",
"this",
".",
"minLearningRate",
",",
"this",
".",
"numEpochs",
"*",
"this",
".",
"num... | This method calculates inferred vector for given text, with default parameters for learning rate and iterations
@param text
@return | [
"This",
"method",
"calculates",
"inferred",
"vector",
"for",
"given",
"text",
"with",
"default",
"parameters",
"for",
"learning",
"rate",
"and",
"iterations"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/paragraphvectors/ParagraphVectors.java#L292-L294 |
128,503 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/paragraphvectors/ParagraphVectors.java | ParagraphVectors.inferVector | public INDArray inferVector(LabelledDocument document) {
return inferVector(document, this.learningRate.get(), this.minLearningRate,
this.numEpochs * this.numIterations);
} | java | public INDArray inferVector(LabelledDocument document) {
return inferVector(document, this.learningRate.get(), this.minLearningRate,
this.numEpochs * this.numIterations);
} | [
"public",
"INDArray",
"inferVector",
"(",
"LabelledDocument",
"document",
")",
"{",
"return",
"inferVector",
"(",
"document",
",",
"this",
".",
"learningRate",
".",
"get",
"(",
")",
",",
"this",
".",
"minLearningRate",
",",
"this",
".",
"numEpochs",
"*",
"th... | This method calculates inferred vector for given document, with default parameters for learning rate and iterations
@param document
@return | [
"This",
"method",
"calculates",
"inferred",
"vector",
"for",
"given",
"document",
"with",
"default",
"parameters",
"for",
"learning",
"rate",
"and",
"iterations"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/paragraphvectors/ParagraphVectors.java#L302-L305 |
128,504 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/paragraphvectors/ParagraphVectors.java | ParagraphVectors.nearestLabels | public Collection<String> nearestLabels(LabelledDocument document, int topN) {
if (document.getReferencedContent() != null) {
return nearestLabels(document.getReferencedContent(), topN);
} else
return nearestLabels(document.getContent(), topN);
} | java | public Collection<String> nearestLabels(LabelledDocument document, int topN) {
if (document.getReferencedContent() != null) {
return nearestLabels(document.getReferencedContent(), topN);
} else
return nearestLabels(document.getContent(), topN);
} | [
"public",
"Collection",
"<",
"String",
">",
"nearestLabels",
"(",
"LabelledDocument",
"document",
",",
"int",
"topN",
")",
"{",
"if",
"(",
"document",
".",
"getReferencedContent",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"nearestLabels",
"(",
"document",
... | This method returns top N labels nearest to specified document
@param document
@param topN
@return | [
"This",
"method",
"returns",
"top",
"N",
"labels",
"nearest",
"to",
"specified",
"document"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/paragraphvectors/ParagraphVectors.java#L519-L524 |
128,505 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/paragraphvectors/ParagraphVectors.java | ParagraphVectors.nearestLabels | public Collection<String> nearestLabels(INDArray labelVector, int topN) {
if (labelsMatrix == null || labelsList == null || labelsList.isEmpty())
extractLabels();
List<BasicModelUtils.WordSimilarity> result = new ArrayList<>();
// if list still empty - return empty collection
... | java | public Collection<String> nearestLabels(INDArray labelVector, int topN) {
if (labelsMatrix == null || labelsList == null || labelsList.isEmpty())
extractLabels();
List<BasicModelUtils.WordSimilarity> result = new ArrayList<>();
// if list still empty - return empty collection
... | [
"public",
"Collection",
"<",
"String",
">",
"nearestLabels",
"(",
"INDArray",
"labelVector",
",",
"int",
"topN",
")",
"{",
"if",
"(",
"labelsMatrix",
"==",
"null",
"||",
"labelsList",
"==",
"null",
"||",
"labelsList",
".",
"isEmpty",
"(",
")",
")",
"extrac... | This method returns top N labels nearest to specified features vector
@param labelVector
@param topN
@return | [
"This",
"method",
"returns",
"top",
"N",
"labels",
"nearest",
"to",
"specified",
"features",
"vector"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/paragraphvectors/ParagraphVectors.java#L573-L610 |
128,506 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/paragraphvectors/ParagraphVectors.java | ParagraphVectors.getTopN | private List<Double> getTopN(INDArray vec, int N) {
BasicModelUtils.ArrayComparator comparator = new BasicModelUtils.ArrayComparator();
PriorityQueue<Double[]> queue = new PriorityQueue<>(vec.rows(), comparator);
for (int j = 0; j < vec.length(); j++) {
final Double[] pair = new Dou... | java | private List<Double> getTopN(INDArray vec, int N) {
BasicModelUtils.ArrayComparator comparator = new BasicModelUtils.ArrayComparator();
PriorityQueue<Double[]> queue = new PriorityQueue<>(vec.rows(), comparator);
for (int j = 0; j < vec.length(); j++) {
final Double[] pair = new Dou... | [
"private",
"List",
"<",
"Double",
">",
"getTopN",
"(",
"INDArray",
"vec",
",",
"int",
"N",
")",
"{",
"BasicModelUtils",
".",
"ArrayComparator",
"comparator",
"=",
"new",
"BasicModelUtils",
".",
"ArrayComparator",
"(",
")",
";",
"PriorityQueue",
"<",
"Double",
... | Get top N elements
@param vec the vec to extract the top elements from
@param N the number of elements to extract
@return the indices and the sorted top N elements | [
"Get",
"top",
"N",
"elements"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/paragraphvectors/ParagraphVectors.java#L619-L643 |
128,507 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-data/deeplearning4j-datasets/src/main/java/org/deeplearning4j/datasets/mnist/MnistManager.java | MnistManager.close | public void close() {
if (images != null) {
try {
images.close();
} catch (IOException e) {
}
images = null;
}
if (labels != null) {
try {
labels.close();
} catch (IOException e) {
... | java | public void close() {
if (images != null) {
try {
images.close();
} catch (IOException e) {
}
images = null;
}
if (labels != null) {
try {
labels.close();
} catch (IOException e) {
... | [
"public",
"void",
"close",
"(",
")",
"{",
"if",
"(",
"images",
"!=",
"null",
")",
"{",
"try",
"{",
"images",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"}",
"images",
"=",
"null",
";",
"}",
"if",
"(",
"labels"... | Close any resources opened by the manager. | [
"Close",
"any",
"resources",
"opened",
"by",
"the",
"manager",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-data/deeplearning4j-datasets/src/main/java/org/deeplearning4j/datasets/mnist/MnistManager.java#L174-L189 |
128,508 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java | DataSet.copy | @Override
public DataSet copy() {
DataSet ret = new DataSet(getFeatures().dup(), getLabels().dup());
if (getLabelsMaskArray() != null)
ret.setLabelsMaskArray(getLabelsMaskArray().dup());
if (getFeaturesMaskArray() != null)
ret.setFeaturesMaskArray(getFeaturesMaskArray... | java | @Override
public DataSet copy() {
DataSet ret = new DataSet(getFeatures().dup(), getLabels().dup());
if (getLabelsMaskArray() != null)
ret.setLabelsMaskArray(getLabelsMaskArray().dup());
if (getFeaturesMaskArray() != null)
ret.setFeaturesMaskArray(getFeaturesMaskArray... | [
"@",
"Override",
"public",
"DataSet",
"copy",
"(",
")",
"{",
"DataSet",
"ret",
"=",
"new",
"DataSet",
"(",
"getFeatures",
"(",
")",
".",
"dup",
"(",
")",
",",
"getLabels",
"(",
")",
".",
"dup",
"(",
")",
")",
";",
"if",
"(",
"getLabelsMaskArray",
"... | Clone the dataset
@return a clone of the dataset | [
"Clone",
"the",
"dataset"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java#L396-L406 |
128,509 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java | DataSet.reshape | @Override
public DataSet reshape(int rows, int cols) {
DataSet ret = new DataSet(getFeatures().reshape(new long[] {rows, cols}), getLabels());
return ret;
} | java | @Override
public DataSet reshape(int rows, int cols) {
DataSet ret = new DataSet(getFeatures().reshape(new long[] {rows, cols}), getLabels());
return ret;
} | [
"@",
"Override",
"public",
"DataSet",
"reshape",
"(",
"int",
"rows",
",",
"int",
"cols",
")",
"{",
"DataSet",
"ret",
"=",
"new",
"DataSet",
"(",
"getFeatures",
"(",
")",
".",
"reshape",
"(",
"new",
"long",
"[",
"]",
"{",
"rows",
",",
"cols",
"}",
"... | Reshapes the input in to the given rows and columns
@param rows the row size
@param cols the column size
@return a copy of this data op with the input resized | [
"Reshapes",
"the",
"input",
"in",
"to",
"the",
"given",
"rows",
"and",
"columns"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java#L415-L419 |
128,510 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java | DataSet.shuffle | public void shuffle(long seed) {
// just skip shuffle if there's only 1 example
if (numExamples() < 2)
return;
//note here we use the same seed with different random objects guaranteeing same order
List<INDArray> arrays = new ArrayList<>();
List<int[]> dimensions = ... | java | public void shuffle(long seed) {
// just skip shuffle if there's only 1 example
if (numExamples() < 2)
return;
//note here we use the same seed with different random objects guaranteeing same order
List<INDArray> arrays = new ArrayList<>();
List<int[]> dimensions = ... | [
"public",
"void",
"shuffle",
"(",
"long",
"seed",
")",
"{",
"// just skip shuffle if there's only 1 example",
"if",
"(",
"numExamples",
"(",
")",
"<",
"2",
")",
"return",
";",
"//note here we use the same seed with different random objects guaranteeing same order",
"List",
... | Shuffles the dataset in place, given a seed for a random number generator. For reproducibility
This will modify the dataset in place!!
@param seed Seed to use for the random Number Generator | [
"Shuffles",
"the",
"dataset",
"in",
"place",
"given",
"a",
"seed",
"for",
"a",
"random",
"number",
"generator",
".",
"For",
"reproducibility",
"This",
"will",
"modify",
"the",
"dataset",
"in",
"place!!"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java#L444-L477 |
128,511 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java | DataSet.squishToRange | @Override
public void squishToRange(double min, double max) {
for (int i = 0; i < getFeatures().length(); i++) {
double curr = (double) getFeatures().getScalar(i).element();
if (curr < min)
getFeatures().put(i, Nd4j.scalar(min));
else if (curr > max)
... | java | @Override
public void squishToRange(double min, double max) {
for (int i = 0; i < getFeatures().length(); i++) {
double curr = (double) getFeatures().getScalar(i).element();
if (curr < min)
getFeatures().put(i, Nd4j.scalar(min));
else if (curr > max)
... | [
"@",
"Override",
"public",
"void",
"squishToRange",
"(",
"double",
"min",
",",
"double",
"max",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"getFeatures",
"(",
")",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"double",
"curr... | Squeezes input data to a max and a min
@param min the min value to occur in the dataset
@param max the max value to ccur in the dataset | [
"Squeezes",
"input",
"data",
"to",
"a",
"max",
"and",
"a",
"min"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java#L486-L495 |
128,512 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java | DataSet.binarize | @Override
public void binarize(double cutoff) {
INDArray linear = getFeatures().reshape(-1);
for (int i = 0; i < getFeatures().length(); i++) {
double curr = linear.getDouble(i);
if (curr > cutoff)
getFeatures().putScalar(i, 1);
else
... | java | @Override
public void binarize(double cutoff) {
INDArray linear = getFeatures().reshape(-1);
for (int i = 0; i < getFeatures().length(); i++) {
double curr = linear.getDouble(i);
if (curr > cutoff)
getFeatures().putScalar(i, 1);
else
... | [
"@",
"Override",
"public",
"void",
"binarize",
"(",
"double",
"cutoff",
")",
"{",
"INDArray",
"linear",
"=",
"getFeatures",
"(",
")",
".",
"reshape",
"(",
"-",
"1",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"getFeatures",
"(",
")",... | Binarizes the dataset such that any number greater than cutoff is 1 otherwise zero
@param cutoff the cutoff point | [
"Binarizes",
"the",
"dataset",
"such",
"that",
"any",
"number",
"greater",
"than",
"cutoff",
"is",
"1",
"otherwise",
"zero"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java#L555-L565 |
128,513 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java | DataSet.setNewNumberOfLabels | @Override
public void setNewNumberOfLabels(int labels) {
int examples = numExamples();
INDArray newOutcomes = Nd4j.create(examples, labels);
setLabels(newOutcomes);
} | java | @Override
public void setNewNumberOfLabels(int labels) {
int examples = numExamples();
INDArray newOutcomes = Nd4j.create(examples, labels);
setLabels(newOutcomes);
} | [
"@",
"Override",
"public",
"void",
"setNewNumberOfLabels",
"(",
"int",
"labels",
")",
"{",
"int",
"examples",
"=",
"numExamples",
"(",
")",
";",
"INDArray",
"newOutcomes",
"=",
"Nd4j",
".",
"create",
"(",
"examples",
",",
"labels",
")",
";",
"setLabels",
"... | Clears the outcome matrix setting a new number of labels
@param labels the number of labels/columns in the outcome matrix
Note that this clears the labels for each example | [
"Clears",
"the",
"outcome",
"matrix",
"setting",
"a",
"new",
"number",
"of",
"labels"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java#L611-L616 |
128,514 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java | DataSet.setOutcome | @Override
public void setOutcome(int example, int label) {
if (example > numExamples())
throw new IllegalArgumentException("No example at " + example);
if (label > numOutcomes() || label < 0)
throw new IllegalArgumentException("Illegal label");
INDArray outcome = Fea... | java | @Override
public void setOutcome(int example, int label) {
if (example > numExamples())
throw new IllegalArgumentException("No example at " + example);
if (label > numOutcomes() || label < 0)
throw new IllegalArgumentException("Illegal label");
INDArray outcome = Fea... | [
"@",
"Override",
"public",
"void",
"setOutcome",
"(",
"int",
"example",
",",
"int",
"label",
")",
"{",
"if",
"(",
"example",
">",
"numExamples",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"No example at \"",
"+",
"example",
")",
";",
... | Sets the outcome of a particular example
@param example the example to transform
@param label the label of the outcome | [
"Sets",
"the",
"outcome",
"of",
"a",
"particular",
"example"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java#L624-L633 |
128,515 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java | DataSet.batchBy | @Override
public List<DataSet> batchBy(int num) {
List<DataSet> batched = Lists.newArrayList();
for (List<DataSet> splitBatch : Lists.partition(asList(), num)) {
batched.add(DataSet.merge(splitBatch));
}
return batched;
} | java | @Override
public List<DataSet> batchBy(int num) {
List<DataSet> batched = Lists.newArrayList();
for (List<DataSet> splitBatch : Lists.partition(asList(), num)) {
batched.add(DataSet.merge(splitBatch));
}
return batched;
} | [
"@",
"Override",
"public",
"List",
"<",
"DataSet",
">",
"batchBy",
"(",
"int",
"num",
")",
"{",
"List",
"<",
"DataSet",
">",
"batched",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"for",
"(",
"List",
"<",
"DataSet",
">",
"splitBatch",
":",
"Lis... | Partitions a dataset in to mini batches where
each dataset in each list is of the specified number of examples
@param num the number to split by
@return the partitioned datasets | [
"Partitions",
"a",
"dataset",
"in",
"to",
"mini",
"batches",
"where",
"each",
"dataset",
"in",
"each",
"list",
"is",
"of",
"the",
"specified",
"number",
"of",
"examples"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java#L672-L679 |
128,516 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java | DataSet.filterBy | @Override
public DataSet filterBy(int[] labels) {
List<DataSet> list = asList();
List<DataSet> newList = new ArrayList<>();
List<Integer> labelList = new ArrayList<>();
for (int i : labels)
labelList.add(i);
for (DataSet d : list) {
int outcome = d.out... | java | @Override
public DataSet filterBy(int[] labels) {
List<DataSet> list = asList();
List<DataSet> newList = new ArrayList<>();
List<Integer> labelList = new ArrayList<>();
for (int i : labels)
labelList.add(i);
for (DataSet d : list) {
int outcome = d.out... | [
"@",
"Override",
"public",
"DataSet",
"filterBy",
"(",
"int",
"[",
"]",
"labels",
")",
"{",
"List",
"<",
"DataSet",
">",
"list",
"=",
"asList",
"(",
")",
";",
"List",
"<",
"DataSet",
">",
"newList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"Li... | Strips the data transform of all but the passed in labels
@param labels strips the data transform of all but the passed in labels
@return the dataset with only the specified labels | [
"Strips",
"the",
"data",
"transform",
"of",
"all",
"but",
"the",
"passed",
"in",
"labels"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java#L687-L702 |
128,517 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java | DataSet.filterAndStrip | @Override
public void filterAndStrip(int[] labels) {
DataSet filtered = filterBy(labels);
List<Integer> newLabels = new ArrayList<>();
//map new labels to index according to passed in labels
Map<Integer, Integer> labelMap = new HashMap<>();
for (int i = 0; i < labels.length... | java | @Override
public void filterAndStrip(int[] labels) {
DataSet filtered = filterBy(labels);
List<Integer> newLabels = new ArrayList<>();
//map new labels to index according to passed in labels
Map<Integer, Integer> labelMap = new HashMap<>();
for (int i = 0; i < labels.length... | [
"@",
"Override",
"public",
"void",
"filterAndStrip",
"(",
"int",
"[",
"]",
"labels",
")",
"{",
"DataSet",
"filtered",
"=",
"filterBy",
"(",
"labels",
")",
";",
"List",
"<",
"Integer",
">",
"newLabels",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"//m... | Strips the dataset down to the specified labels
and remaps them
@param labels the labels to strip down to | [
"Strips",
"the",
"dataset",
"down",
"to",
"the",
"specified",
"labels",
"and",
"remaps",
"them"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java#L710-L747 |
128,518 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java | DataSet.dataSetBatches | @Override
public List<DataSet> dataSetBatches(int num) {
List<List<DataSet>> list = Lists.partition(asList(), num);
List<DataSet> ret = new ArrayList<>();
for (List<DataSet> l : list)
ret.add(DataSet.merge(l));
return ret;
} | java | @Override
public List<DataSet> dataSetBatches(int num) {
List<List<DataSet>> list = Lists.partition(asList(), num);
List<DataSet> ret = new ArrayList<>();
for (List<DataSet> l : list)
ret.add(DataSet.merge(l));
return ret;
} | [
"@",
"Override",
"public",
"List",
"<",
"DataSet",
">",
"dataSetBatches",
"(",
"int",
"num",
")",
"{",
"List",
"<",
"List",
"<",
"DataSet",
">>",
"list",
"=",
"Lists",
".",
"partition",
"(",
"asList",
"(",
")",
",",
"num",
")",
";",
"List",
"<",
"D... | Partitions the data transform by the specified number.
@param num the number to split by
@return the partitioned data transform | [
"Partitions",
"the",
"data",
"transform",
"by",
"the",
"specified",
"number",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java#L755-L763 |
128,519 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java | DataSet.sortByLabel | @Override
public void sortByLabel() {
Map<Integer, Queue<DataSet>> map = new HashMap<>();
List<DataSet> data = asList();
int numLabels = numOutcomes();
int examples = numExamples();
for (DataSet d : data) {
int label = d.outcome();
Queue<DataSet> q = m... | java | @Override
public void sortByLabel() {
Map<Integer, Queue<DataSet>> map = new HashMap<>();
List<DataSet> data = asList();
int numLabels = numOutcomes();
int examples = numExamples();
for (DataSet d : data) {
int label = d.outcome();
Queue<DataSet> q = m... | [
"@",
"Override",
"public",
"void",
"sortByLabel",
"(",
")",
"{",
"Map",
"<",
"Integer",
",",
"Queue",
"<",
"DataSet",
">",
">",
"map",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"List",
"<",
"DataSet",
">",
"data",
"=",
"asList",
"(",
")",
";",
... | Organizes the dataset to minimize sampling error
while still allowing efficient batching. | [
"Organizes",
"the",
"dataset",
"to",
"minimize",
"sampling",
"error",
"while",
"still",
"allowing",
"efficient",
"batching",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java#L973-L1031 |
128,520 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java | DataSet.sample | @Override
public DataSet sample(int numSamples, org.nd4j.linalg.api.rng.Random rng) {
return sample(numSamples, rng, false);
} | java | @Override
public DataSet sample(int numSamples, org.nd4j.linalg.api.rng.Random rng) {
return sample(numSamples, rng, false);
} | [
"@",
"Override",
"public",
"DataSet",
"sample",
"(",
"int",
"numSamples",
",",
"org",
".",
"nd4j",
".",
"linalg",
".",
"api",
".",
"rng",
".",
"Random",
"rng",
")",
"{",
"return",
"sample",
"(",
"numSamples",
",",
"rng",
",",
"false",
")",
";",
"}"
] | Sample without replacement
@param numSamples the number of samples to getFromOrigin
@param rng the rng to use
@return the sampled dataset without replacement | [
"Sample",
"without",
"replacement"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java#L1083-L1086 |
128,521 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java | DataSet.sample | @Override
public DataSet sample(int numSamples, boolean withReplacement) {
return sample(numSamples, Nd4j.getRandom(), withReplacement);
} | java | @Override
public DataSet sample(int numSamples, boolean withReplacement) {
return sample(numSamples, Nd4j.getRandom(), withReplacement);
} | [
"@",
"Override",
"public",
"DataSet",
"sample",
"(",
"int",
"numSamples",
",",
"boolean",
"withReplacement",
")",
"{",
"return",
"sample",
"(",
"numSamples",
",",
"Nd4j",
".",
"getRandom",
"(",
")",
",",
"withReplacement",
")",
";",
"}"
] | Sample a dataset numSamples times
@param numSamples the number of samples to getFromOrigin
@param withReplacement the rng to use
@return the sampled dataset without replacement | [
"Sample",
"a",
"dataset",
"numSamples",
"times"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java#L1095-L1098 |
128,522 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java | DataSet.sample | @Override
public DataSet sample(int numSamples, org.nd4j.linalg.api.rng.Random rng, boolean withReplacement) {
Set<Integer> added = new HashSet<>();
List<DataSet> toMerge = new ArrayList<>();
boolean terminate = false;
for (int i = 0; i < numSamples && !terminate; i++) {
... | java | @Override
public DataSet sample(int numSamples, org.nd4j.linalg.api.rng.Random rng, boolean withReplacement) {
Set<Integer> added = new HashSet<>();
List<DataSet> toMerge = new ArrayList<>();
boolean terminate = false;
for (int i = 0; i < numSamples && !terminate; i++) {
... | [
"@",
"Override",
"public",
"DataSet",
"sample",
"(",
"int",
"numSamples",
",",
"org",
".",
"nd4j",
".",
"linalg",
".",
"api",
".",
"rng",
".",
"Random",
"rng",
",",
"boolean",
"withReplacement",
")",
"{",
"Set",
"<",
"Integer",
">",
"added",
"=",
"new"... | Sample a dataset
@param numSamples the number of samples to getFromOrigin
@param rng the rng to use
@param withReplacement whether to allow duplicates (only tracked by example row number)
@return the sample dataset | [
"Sample",
"a",
"dataset"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java#L1108-L1128 |
128,523 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-native-api/src/main/java/org/nd4j/compression/impl/AbstractCompressor.java | AbstractCompressor.compressi | @Override
public void compressi(INDArray array) {
// TODO: lift this restriction
if (array.isView())
throw new UnsupportedOperationException("Impossible to apply inplace compression on View");
array.setData(compress(array.data()));
array.markAsCompressed(true);
} | java | @Override
public void compressi(INDArray array) {
// TODO: lift this restriction
if (array.isView())
throw new UnsupportedOperationException("Impossible to apply inplace compression on View");
array.setData(compress(array.data()));
array.markAsCompressed(true);
} | [
"@",
"Override",
"public",
"void",
"compressi",
"(",
"INDArray",
"array",
")",
"{",
"// TODO: lift this restriction",
"if",
"(",
"array",
".",
"isView",
"(",
")",
")",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Impossible to apply inplace compression on Vi... | Inplace compression of INDArray
@param array | [
"Inplace",
"compression",
"of",
"INDArray"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-native-api/src/main/java/org/nd4j/compression/impl/AbstractCompressor.java#L66-L74 |
128,524 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-native-api/src/main/java/org/nd4j/compression/impl/AbstractCompressor.java | AbstractCompressor.compress | @Override
public INDArray compress(float[] data, int[] shape, char order) {
FloatPointer pointer = new FloatPointer(data);
DataBuffer shapeInfo = Nd4j.getShapeInfoProvider().createShapeInformation(ArrayUtil.toLongArray(shape), order, DataType.FLOAT).getFirst();
DataBuffer buffer = compressP... | java | @Override
public INDArray compress(float[] data, int[] shape, char order) {
FloatPointer pointer = new FloatPointer(data);
DataBuffer shapeInfo = Nd4j.getShapeInfoProvider().createShapeInformation(ArrayUtil.toLongArray(shape), order, DataType.FLOAT).getFirst();
DataBuffer buffer = compressP... | [
"@",
"Override",
"public",
"INDArray",
"compress",
"(",
"float",
"[",
"]",
"data",
",",
"int",
"[",
"]",
"shape",
",",
"char",
"order",
")",
"{",
"FloatPointer",
"pointer",
"=",
"new",
"FloatPointer",
"(",
"data",
")",
";",
"DataBuffer",
"shapeInfo",
"="... | This method creates compressed INDArray from Java float array, skipping usual INDArray instantiation routines
@param data
@param shape
@param order
@return | [
"This",
"method",
"creates",
"compressed",
"INDArray",
"from",
"Java",
"float",
"array",
"skipping",
"usual",
"INDArray",
"instantiation",
"routines"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-native-api/src/main/java/org/nd4j/compression/impl/AbstractCompressor.java#L157-L165 |
128,525 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-graph/src/main/java/org/deeplearning4j/graph/models/deepwalk/DeepWalk.java | DeepWalk.initialize | public void initialize(IGraph<V, E> graph) {
int nVertices = graph.numVertices();
int[] degrees = new int[nVertices];
for (int i = 0; i < nVertices; i++)
degrees[i] = graph.getVertexDegree(i);
initialize(degrees);
} | java | public void initialize(IGraph<V, E> graph) {
int nVertices = graph.numVertices();
int[] degrees = new int[nVertices];
for (int i = 0; i < nVertices; i++)
degrees[i] = graph.getVertexDegree(i);
initialize(degrees);
} | [
"public",
"void",
"initialize",
"(",
"IGraph",
"<",
"V",
",",
"E",
">",
"graph",
")",
"{",
"int",
"nVertices",
"=",
"graph",
".",
"numVertices",
"(",
")",
";",
"int",
"[",
"]",
"degrees",
"=",
"new",
"int",
"[",
"nVertices",
"]",
";",
"for",
"(",
... | Initialize the DeepWalk model with a given graph. | [
"Initialize",
"the",
"DeepWalk",
"model",
"with",
"a",
"given",
"graph",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-graph/src/main/java/org/deeplearning4j/graph/models/deepwalk/DeepWalk.java#L84-L90 |
128,526 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-graph/src/main/java/org/deeplearning4j/graph/models/deepwalk/DeepWalk.java | DeepWalk.fit | public void fit(IGraph<V, E> graph, int walkLength) {
if (!initCalled)
initialize(graph);
//First: create iterators, one for each thread
GraphWalkIteratorProvider<V> iteratorProvider = new RandomWalkGraphIteratorProvider<>(graph, walkLength, seed,
NoEdgeHandl... | java | public void fit(IGraph<V, E> graph, int walkLength) {
if (!initCalled)
initialize(graph);
//First: create iterators, one for each thread
GraphWalkIteratorProvider<V> iteratorProvider = new RandomWalkGraphIteratorProvider<>(graph, walkLength, seed,
NoEdgeHandl... | [
"public",
"void",
"fit",
"(",
"IGraph",
"<",
"V",
",",
"E",
">",
"graph",
",",
"int",
"walkLength",
")",
"{",
"if",
"(",
"!",
"initCalled",
")",
"initialize",
"(",
"graph",
")",
";",
"//First: create iterators, one for each thread",
"GraphWalkIteratorProvider",
... | Fit the model, in parallel.
This creates a set of GraphWalkIterators, which are then distributed one to each thread
@param graph Graph to fit
@param walkLength Length of rangom walks to generate | [
"Fit",
"the",
"model",
"in",
"parallel",
".",
"This",
"creates",
"a",
"set",
"of",
"GraphWalkIterators",
"which",
"are",
"then",
"distributed",
"one",
"to",
"each",
"thread"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-graph/src/main/java/org/deeplearning4j/graph/models/deepwalk/DeepWalk.java#L112-L121 |
128,527 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPHyperPlanes.java | RPHyperPlanes.addRandomHyperPlane | public void addRandomHyperPlane() {
INDArray newPlane = Nd4j.randn(new int[] {1,dim});
newPlane.divi(newPlane.normmaxNumber());
if(wholeHyperPlane == null)
wholeHyperPlane = newPlane;
else {
wholeHyperPlane = Nd4j.concat(0,wholeHyperPlane,newPlane);
}
... | java | public void addRandomHyperPlane() {
INDArray newPlane = Nd4j.randn(new int[] {1,dim});
newPlane.divi(newPlane.normmaxNumber());
if(wholeHyperPlane == null)
wholeHyperPlane = newPlane;
else {
wholeHyperPlane = Nd4j.concat(0,wholeHyperPlane,newPlane);
}
... | [
"public",
"void",
"addRandomHyperPlane",
"(",
")",
"{",
"INDArray",
"newPlane",
"=",
"Nd4j",
".",
"randn",
"(",
"new",
"int",
"[",
"]",
"{",
"1",
",",
"dim",
"}",
")",
";",
"newPlane",
".",
"divi",
"(",
"newPlane",
".",
"normmaxNumber",
"(",
")",
")"... | Add a new random element to the hyper plane. | [
"Add",
"a",
"new",
"random",
"element",
"to",
"the",
"hyper",
"plane",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPHyperPlanes.java#L42-L50 |
128,528 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/serde/binary/BinarySerde.java | BinarySerde.toArrayAndByteBuffer | public static Pair<INDArray, ByteBuffer> toArrayAndByteBuffer(ByteBuffer buffer, int offset) {
ByteBuffer byteBuffer = buffer.hasArray() ? ByteBuffer.allocateDirect(buffer.array().length).put(buffer.array())
.order(ByteOrder.nativeOrder()) : buffer.order(ByteOrder.nativeOrder());
//bump ... | java | public static Pair<INDArray, ByteBuffer> toArrayAndByteBuffer(ByteBuffer buffer, int offset) {
ByteBuffer byteBuffer = buffer.hasArray() ? ByteBuffer.allocateDirect(buffer.array().length).put(buffer.array())
.order(ByteOrder.nativeOrder()) : buffer.order(ByteOrder.nativeOrder());
//bump ... | [
"public",
"static",
"Pair",
"<",
"INDArray",
",",
"ByteBuffer",
">",
"toArrayAndByteBuffer",
"(",
"ByteBuffer",
"buffer",
",",
"int",
"offset",
")",
"{",
"ByteBuffer",
"byteBuffer",
"=",
"buffer",
".",
"hasArray",
"(",
")",
"?",
"ByteBuffer",
".",
"allocateDir... | Create an ndarray and existing bytebuffer
@param buffer
@param offset
@return | [
"Create",
"an",
"ndarray",
"and",
"existing",
"bytebuffer"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/serde/binary/BinarySerde.java#L74-L122 |
128,529 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/serde/binary/BinarySerde.java | BinarySerde.toByteBuffer | public static ByteBuffer toByteBuffer(INDArray arr) {
//subset and get rid of 1 off non 1 element wise stride cases
if (arr.isView())
arr = arr.dup();
if (!arr.isCompressed()) {
ByteBuffer b3 = ByteBuffer.allocateDirect(byteBufferSizeFor(arr)).order(ByteOrder.nativeOrder(... | java | public static ByteBuffer toByteBuffer(INDArray arr) {
//subset and get rid of 1 off non 1 element wise stride cases
if (arr.isView())
arr = arr.dup();
if (!arr.isCompressed()) {
ByteBuffer b3 = ByteBuffer.allocateDirect(byteBufferSizeFor(arr)).order(ByteOrder.nativeOrder(... | [
"public",
"static",
"ByteBuffer",
"toByteBuffer",
"(",
"INDArray",
"arr",
")",
"{",
"//subset and get rid of 1 off non 1 element wise stride cases",
"if",
"(",
"arr",
".",
"isView",
"(",
")",
")",
"arr",
"=",
"arr",
".",
"dup",
"(",
")",
";",
"if",
"(",
"!",
... | Convert an ndarray to an unsafe buffer
for use by aeron
@param arr the array to convert
@return the unsafebuffer representation of this array | [
"Convert",
"an",
"ndarray",
"to",
"an",
"unsafe",
"buffer",
"for",
"use",
"by",
"aeron"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/serde/binary/BinarySerde.java#L131-L147 |
128,530 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/serde/binary/BinarySerde.java | BinarySerde.byteBufferSizeFor | public static int byteBufferSizeFor(INDArray arr) {
if (!arr.isCompressed()) {
ByteBuffer buffer = arr.data().pointer().asByteBuffer().order(ByteOrder.nativeOrder());
ByteBuffer shapeBuffer = arr.shapeInfoDataBuffer().pointer().asByteBuffer().order(ByteOrder.nativeOrder());
/... | java | public static int byteBufferSizeFor(INDArray arr) {
if (!arr.isCompressed()) {
ByteBuffer buffer = arr.data().pointer().asByteBuffer().order(ByteOrder.nativeOrder());
ByteBuffer shapeBuffer = arr.shapeInfoDataBuffer().pointer().asByteBuffer().order(ByteOrder.nativeOrder());
/... | [
"public",
"static",
"int",
"byteBufferSizeFor",
"(",
"INDArray",
"arr",
")",
"{",
"if",
"(",
"!",
"arr",
".",
"isCompressed",
"(",
")",
")",
"{",
"ByteBuffer",
"buffer",
"=",
"arr",
".",
"data",
"(",
")",
".",
"pointer",
"(",
")",
".",
"asByteBuffer",
... | Returns the byte buffer size for the given
ndarray. This is an auxillary method
for determining the size of the buffer
size to allocate for sending an ndarray via
the aeron media driver.
The math break down for uncompressed is:
2 ints for rank of the array and an ordinal representing the data opType of the data buffer... | [
"Returns",
"the",
"byte",
"buffer",
"size",
"for",
"the",
"given",
"ndarray",
".",
"This",
"is",
"an",
"auxillary",
"method",
"for",
"determining",
"the",
"size",
"of",
"the",
"buffer",
"size",
"to",
"allocate",
"for",
"sending",
"an",
"ndarray",
"via",
"t... | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/serde/binary/BinarySerde.java#L173-L189 |
128,531 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/serde/binary/BinarySerde.java | BinarySerde.writeArrayToOutputStream | public static void writeArrayToOutputStream(INDArray arr, OutputStream outputStream) {
ByteBuffer buffer = BinarySerde.toByteBuffer(arr);
try (WritableByteChannel channel = Channels.newChannel(outputStream)) {
channel.write(buffer);
} catch (IOException e) {
e.printStackT... | java | public static void writeArrayToOutputStream(INDArray arr, OutputStream outputStream) {
ByteBuffer buffer = BinarySerde.toByteBuffer(arr);
try (WritableByteChannel channel = Channels.newChannel(outputStream)) {
channel.write(buffer);
} catch (IOException e) {
e.printStackT... | [
"public",
"static",
"void",
"writeArrayToOutputStream",
"(",
"INDArray",
"arr",
",",
"OutputStream",
"outputStream",
")",
"{",
"ByteBuffer",
"buffer",
"=",
"BinarySerde",
".",
"toByteBuffer",
"(",
"arr",
")",
";",
"try",
"(",
"WritableByteChannel",
"channel",
"=",... | Write an array to an output stream.
@param arr the array to write
@param outputStream the output stream to write to | [
"Write",
"an",
"array",
"to",
"an",
"output",
"stream",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/serde/binary/BinarySerde.java#L260-L267 |
128,532 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/serde/binary/BinarySerde.java | BinarySerde.writeArrayToDisk | public static void writeArrayToDisk(INDArray arr, File toWrite) throws IOException {
try (FileOutputStream os = new FileOutputStream(toWrite)) {
FileChannel channel = os.getChannel();
ByteBuffer buffer = BinarySerde.toByteBuffer(arr);
channel.write(buffer);
}
} | java | public static void writeArrayToDisk(INDArray arr, File toWrite) throws IOException {
try (FileOutputStream os = new FileOutputStream(toWrite)) {
FileChannel channel = os.getChannel();
ByteBuffer buffer = BinarySerde.toByteBuffer(arr);
channel.write(buffer);
}
} | [
"public",
"static",
"void",
"writeArrayToDisk",
"(",
"INDArray",
"arr",
",",
"File",
"toWrite",
")",
"throws",
"IOException",
"{",
"try",
"(",
"FileOutputStream",
"os",
"=",
"new",
"FileOutputStream",
"(",
"toWrite",
")",
")",
"{",
"FileChannel",
"channel",
"=... | Write an ndarray to disk in
binary format
@param arr the array to write
@param toWrite the file tow rite to
@throws IOException | [
"Write",
"an",
"ndarray",
"to",
"disk",
"in",
"binary",
"format"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/serde/binary/BinarySerde.java#L277-L283 |
128,533 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/serde/binary/BinarySerde.java | BinarySerde.readFromDisk | public static INDArray readFromDisk(File readFrom) throws IOException {
try (FileInputStream os = new FileInputStream(readFrom)) {
FileChannel channel = os.getChannel();
ByteBuffer buffer = ByteBuffer.allocateDirect((int) readFrom.length());
channel.read(buffer);
... | java | public static INDArray readFromDisk(File readFrom) throws IOException {
try (FileInputStream os = new FileInputStream(readFrom)) {
FileChannel channel = os.getChannel();
ByteBuffer buffer = ByteBuffer.allocateDirect((int) readFrom.length());
channel.read(buffer);
... | [
"public",
"static",
"INDArray",
"readFromDisk",
"(",
"File",
"readFrom",
")",
"throws",
"IOException",
"{",
"try",
"(",
"FileInputStream",
"os",
"=",
"new",
"FileInputStream",
"(",
"readFrom",
")",
")",
"{",
"FileChannel",
"channel",
"=",
"os",
".",
"getChanne... | Read an ndarray from disk
@param readFrom
@return
@throws IOException | [
"Read",
"an",
"ndarray",
"from",
"disk"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/serde/binary/BinarySerde.java#L292-L300 |
128,534 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/serde/binary/BinarySerde.java | BinarySerde.readShapeFromDisk | public static DataBuffer readShapeFromDisk(File readFrom) throws IOException {
try (FileInputStream os = new FileInputStream(readFrom)) {
FileChannel channel = os.getChannel();
// we read shapeinfo up to max_rank value, which is 32
int len = (int) Math.min((32 * 2 + 3) * 8, r... | java | public static DataBuffer readShapeFromDisk(File readFrom) throws IOException {
try (FileInputStream os = new FileInputStream(readFrom)) {
FileChannel channel = os.getChannel();
// we read shapeinfo up to max_rank value, which is 32
int len = (int) Math.min((32 * 2 + 3) * 8, r... | [
"public",
"static",
"DataBuffer",
"readShapeFromDisk",
"(",
"File",
"readFrom",
")",
"throws",
"IOException",
"{",
"try",
"(",
"FileInputStream",
"os",
"=",
"new",
"FileInputStream",
"(",
"readFrom",
")",
")",
"{",
"FileChannel",
"channel",
"=",
"os",
".",
"ge... | This method returns shape databuffer from saved earlier file
@param readFrom
@return
@throws IOException | [
"This",
"method",
"returns",
"shape",
"databuffer",
"from",
"saved",
"earlier",
"file"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/serde/binary/BinarySerde.java#L310-L342 |
128,535 | deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-status/src/main/java/org/nd4j/parameterserver/status/play/MapDbStatusStorage.java | MapDbStatusStorage.createUpdatedMap | @Override
public Map<Integer, Long> createUpdatedMap() {
if (storageFile == null) {
//In-Memory Stats Storage
db = DBMaker.memoryDB().make();
} else {
db = DBMaker.fileDB(storageFile).closeOnJvmShutdown().transactionEnable() //Default to Write Ahead Log - lower pe... | java | @Override
public Map<Integer, Long> createUpdatedMap() {
if (storageFile == null) {
//In-Memory Stats Storage
db = DBMaker.memoryDB().make();
} else {
db = DBMaker.fileDB(storageFile).closeOnJvmShutdown().transactionEnable() //Default to Write Ahead Log - lower pe... | [
"@",
"Override",
"public",
"Map",
"<",
"Integer",
",",
"Long",
">",
"createUpdatedMap",
"(",
")",
"{",
"if",
"(",
"storageFile",
"==",
"null",
")",
"{",
"//In-Memory Stats Storage",
"db",
"=",
"DBMaker",
".",
"memoryDB",
"(",
")",
".",
"make",
"(",
")",
... | Create the storage map
@return | [
"Create",
"the",
"storage",
"map"
] | 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/MapDbStatusStorage.java#L56-L69 |
128,536 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/concurrency/CudaAffinityManager.java | CudaAffinityManager.getNextDevice | protected Integer getNextDevice(long threadId) {
Integer device = null;
if (!CudaEnvironment.getInstance().getConfiguration().isForcedSingleGPU() && getNumberOfDevices() > 0) {
// simple round-robin here
synchronized (this) {
device = CudaEnvironment.getInstance()... | java | protected Integer getNextDevice(long threadId) {
Integer device = null;
if (!CudaEnvironment.getInstance().getConfiguration().isForcedSingleGPU() && getNumberOfDevices() > 0) {
// simple round-robin here
synchronized (this) {
device = CudaEnvironment.getInstance()... | [
"protected",
"Integer",
"getNextDevice",
"(",
"long",
"threadId",
")",
"{",
"Integer",
"device",
"=",
"null",
";",
"if",
"(",
"!",
"CudaEnvironment",
".",
"getInstance",
"(",
")",
".",
"getConfiguration",
"(",
")",
".",
"isForcedSingleGPU",
"(",
")",
"&&",
... | This method returns device id available. Round-robin balancing used here.
@param threadId this parameter can be anything, it's used for logging only.
@return | [
"This",
"method",
"returns",
"device",
"id",
"available",
".",
"Round",
"-",
"robin",
"balancing",
"used",
"here",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/concurrency/CudaAffinityManager.java#L173-L195 |
128,537 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/concurrency/CudaAffinityManager.java | CudaAffinityManager.getNumberOfDevices | @Override
public int getNumberOfDevices() {
if (numberOfDevices.get() < 0) {
synchronized (this) {
if (numberOfDevices.get() < 1) {
numberOfDevices.set(NativeOpsHolder.getInstance().getDeviceNativeOps().getAvailableDevices());
}
}
... | java | @Override
public int getNumberOfDevices() {
if (numberOfDevices.get() < 0) {
synchronized (this) {
if (numberOfDevices.get() < 1) {
numberOfDevices.set(NativeOpsHolder.getInstance().getDeviceNativeOps().getAvailableDevices());
}
}
... | [
"@",
"Override",
"public",
"int",
"getNumberOfDevices",
"(",
")",
"{",
"if",
"(",
"numberOfDevices",
".",
"get",
"(",
")",
"<",
"0",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"numberOfDevices",
".",
"get",
"(",
")",
"<",
"1",
")",
... | This method returns number of available devices in system.
Please note: returned value might be different from actual number of used devices.
@return total number of devices | [
"This",
"method",
"returns",
"number",
"of",
"available",
"devices",
"in",
"system",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/concurrency/CudaAffinityManager.java#L204-L215 |
128,538 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/concurrency/CudaAffinityManager.java | CudaAffinityManager.replicateToDevice | @Override
public synchronized INDArray replicateToDevice(Integer deviceId, INDArray array) {
if (array == null)
return null;
// string arrays are stored in host memory only atm
if (array.isS())
return array.dup(array.ordering());
if (array.isView())
... | java | @Override
public synchronized INDArray replicateToDevice(Integer deviceId, INDArray array) {
if (array == null)
return null;
// string arrays are stored in host memory only atm
if (array.isS())
return array.dup(array.ordering());
if (array.isView())
... | [
"@",
"Override",
"public",
"synchronized",
"INDArray",
"replicateToDevice",
"(",
"Integer",
"deviceId",
",",
"INDArray",
"array",
")",
"{",
"if",
"(",
"array",
"==",
"null",
")",
"return",
"null",
";",
"// string arrays are stored in host memory only atm",
"if",
"("... | This method replicates given INDArray, and places it to target device.
@param deviceId target deviceId
@param array INDArray to replicate
@return | [
"This",
"method",
"replicates",
"given",
"INDArray",
"and",
"places",
"it",
"to",
"target",
"device",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/concurrency/CudaAffinityManager.java#L257-L300 |
128,539 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/concurrency/CudaAffinityManager.java | CudaAffinityManager.replicateToDevice | @Override
public DataBuffer replicateToDevice(Integer deviceId, DataBuffer buffer) {
if (buffer == null)
return null;
int currentDeviceId = AtomicAllocator.getInstance().getDeviceId();
if (currentDeviceId != deviceId) {
Nd4j.getMemoryManager().releaseCurrentContext()... | java | @Override
public DataBuffer replicateToDevice(Integer deviceId, DataBuffer buffer) {
if (buffer == null)
return null;
int currentDeviceId = AtomicAllocator.getInstance().getDeviceId();
if (currentDeviceId != deviceId) {
Nd4j.getMemoryManager().releaseCurrentContext()... | [
"@",
"Override",
"public",
"DataBuffer",
"replicateToDevice",
"(",
"Integer",
"deviceId",
",",
"DataBuffer",
"buffer",
")",
"{",
"if",
"(",
"buffer",
"==",
"null",
")",
"return",
"null",
";",
"int",
"currentDeviceId",
"=",
"AtomicAllocator",
".",
"getInstance",
... | This method replicates given DataBuffer, and places it to target device.
@param deviceId target deviceId
@param buffer
@return | [
"This",
"method",
"replicates",
"given",
"DataBuffer",
"and",
"places",
"it",
"to",
"target",
"device",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/concurrency/CudaAffinityManager.java#L309-L331 |
128,540 | deeplearning4j/deeplearning4j | arbiter/arbiter-deeplearning4j/src/main/java/org/deeplearning4j/arbiter/ComputationGraphSpace.java | ComputationGraphSpace.fromYaml | public static ComputationGraphSpace fromYaml(String yaml) {
try {
return YamlMapper.getMapper().readValue(yaml, ComputationGraphSpace.class);
} catch (IOException e) {
throw new RuntimeException(e);
}
} | java | public static ComputationGraphSpace fromYaml(String yaml) {
try {
return YamlMapper.getMapper().readValue(yaml, ComputationGraphSpace.class);
} catch (IOException e) {
throw new RuntimeException(e);
}
} | [
"public",
"static",
"ComputationGraphSpace",
"fromYaml",
"(",
"String",
"yaml",
")",
"{",
"try",
"{",
"return",
"YamlMapper",
".",
"getMapper",
"(",
")",
".",
"readValue",
"(",
"yaml",
",",
"ComputationGraphSpace",
".",
"class",
")",
";",
"}",
"catch",
"(",
... | Instantiate a computation graph space
from a raw yaml string
@param yaml
@return | [
"Instantiate",
"a",
"computation",
"graph",
"space",
"from",
"a",
"raw",
"yaml",
"string"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/arbiter/arbiter-deeplearning4j/src/main/java/org/deeplearning4j/arbiter/ComputationGraphSpace.java#L309-L315 |
128,541 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/constant/ProtectedCudaConstantHandler.java | ProtectedCudaConstantHandler.purgeConstants | @Override
public void purgeConstants() {
buffersCache = new HashMap<>();
protector.purgeProtector();
resetHappened = true;
logger.info("Resetting Constants...");
for (Integer device : constantOffsets.keySet()) {
constantOffsets.get(device).set(0);
b... | java | @Override
public void purgeConstants() {
buffersCache = new HashMap<>();
protector.purgeProtector();
resetHappened = true;
logger.info("Resetting Constants...");
for (Integer device : constantOffsets.keySet()) {
constantOffsets.get(device).set(0);
b... | [
"@",
"Override",
"public",
"void",
"purgeConstants",
"(",
")",
"{",
"buffersCache",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"protector",
".",
"purgeProtector",
"(",
")",
";",
"resetHappened",
"=",
"true",
";",
"logger",
".",
"info",
"(",
"\"Resetting C... | This method removes all cached constants | [
"This",
"method",
"removes",
"all",
"cached",
"constants"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/constant/ProtectedCudaConstantHandler.java#L87-L100 |
128,542 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/allocator/concurrency/DeviceAllocationsTracker.java | DeviceAllocationsTracker.reserveAllocationIfPossible | public boolean reserveAllocationIfPossible(Long threadId, Integer deviceId, long memorySize) {
ensureThreadRegistered(threadId, deviceId);
try {
deviceLocks.get(deviceId).writeLock().lock();
/*
if (getAllocatedSize(deviceId) + memorySize + getReservedSpace(deviceId)> ... | java | public boolean reserveAllocationIfPossible(Long threadId, Integer deviceId, long memorySize) {
ensureThreadRegistered(threadId, deviceId);
try {
deviceLocks.get(deviceId).writeLock().lock();
/*
if (getAllocatedSize(deviceId) + memorySize + getReservedSpace(deviceId)> ... | [
"public",
"boolean",
"reserveAllocationIfPossible",
"(",
"Long",
"threadId",
",",
"Integer",
"deviceId",
",",
"long",
"memorySize",
")",
"{",
"ensureThreadRegistered",
"(",
"threadId",
",",
"deviceId",
")",
";",
"try",
"{",
"deviceLocks",
".",
"get",
"(",
"devic... | This method "reserves" memory within allocator
@param threadId
@param deviceId
@param memorySize
@return | [
"This",
"method",
"reserves",
"memory",
"within",
"allocator"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/allocator/concurrency/DeviceAllocationsTracker.java#L131-L148 |
128,543 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/memory/LayerMemoryReport.java | LayerMemoryReport.scale | public void scale(int scale){
parameterSize *= scale;
updaterStateSize *= scale;
workingMemoryFixedInference *= scale;
workingMemoryVariableInference *= scale;
cacheModeMemFixed = scaleEntries(cacheModeMemFixed, scale);
cacheModeMemVariablePerEx = scaleEntries(cacheModeMe... | java | public void scale(int scale){
parameterSize *= scale;
updaterStateSize *= scale;
workingMemoryFixedInference *= scale;
workingMemoryVariableInference *= scale;
cacheModeMemFixed = scaleEntries(cacheModeMemFixed, scale);
cacheModeMemVariablePerEx = scaleEntries(cacheModeMe... | [
"public",
"void",
"scale",
"(",
"int",
"scale",
")",
"{",
"parameterSize",
"*=",
"scale",
";",
"updaterStateSize",
"*=",
"scale",
";",
"workingMemoryFixedInference",
"*=",
"scale",
";",
"workingMemoryVariableInference",
"*=",
"scale",
";",
"cacheModeMemFixed",
"=",
... | Multiply all memory usage by the specified scaling factor
@param scale Scale factor to multiply all memory usage by | [
"Multiply",
"all",
"memory",
"usage",
"by",
"the",
"specified",
"scaling",
"factor"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/memory/LayerMemoryReport.java#L163-L170 |
128,544 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/cluster/Cluster.java | Cluster.getDistanceToCenter | public double getDistanceToCenter(Point point) {
return Nd4j.getExecutioner().execAndReturn(
ClusterUtils.createDistanceFunctionOp(distanceFunction, center.getArray(), point.getArray()))
.getFinalResult().doubleValue();
} | java | public double getDistanceToCenter(Point point) {
return Nd4j.getExecutioner().execAndReturn(
ClusterUtils.createDistanceFunctionOp(distanceFunction, center.getArray(), point.getArray()))
.getFinalResult().doubleValue();
} | [
"public",
"double",
"getDistanceToCenter",
"(",
"Point",
"point",
")",
"{",
"return",
"Nd4j",
".",
"getExecutioner",
"(",
")",
".",
"execAndReturn",
"(",
"ClusterUtils",
".",
"createDistanceFunctionOp",
"(",
"distanceFunction",
",",
"center",
".",
"getArray",
"(",... | Get the distance to the given
point from the cluster
@param point the point to get the distance for
@return | [
"Get",
"the",
"distance",
"to",
"the",
"given",
"point",
"from",
"the",
"cluster"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/cluster/Cluster.java#L75-L79 |
128,545 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/cluster/Cluster.java | Cluster.addPoint | public void addPoint(Point point, boolean moveClusterCenter) {
if (moveClusterCenter) {
if (isInverse()) {
center.getArray().muli(points.size()).subi(point.getArray()).divi(points.size() + 1);
} else {
center.getArray().muli(points.size()).addi(point.getAr... | java | public void addPoint(Point point, boolean moveClusterCenter) {
if (moveClusterCenter) {
if (isInverse()) {
center.getArray().muli(points.size()).subi(point.getArray()).divi(points.size() + 1);
} else {
center.getArray().muli(points.size()).addi(point.getAr... | [
"public",
"void",
"addPoint",
"(",
"Point",
"point",
",",
"boolean",
"moveClusterCenter",
")",
"{",
"if",
"(",
"moveClusterCenter",
")",
"{",
"if",
"(",
"isInverse",
"(",
")",
")",
"{",
"center",
".",
"getArray",
"(",
")",
".",
"muli",
"(",
"points",
"... | Add a point to the cluster
@param point the point to add
@param moveClusterCenter whether to update
the cluster centroid or not | [
"Add",
"a",
"point",
"to",
"the",
"cluster"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/cluster/Cluster.java#L95-L105 |
128,546 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/cluster/Cluster.java | Cluster.getPoint | public Point getPoint(String id) {
for (Point point : points)
if (id.equals(point.getId()))
return point;
return null;
} | java | public Point getPoint(String id) {
for (Point point : points)
if (id.equals(point.getId()))
return point;
return null;
} | [
"public",
"Point",
"getPoint",
"(",
"String",
"id",
")",
"{",
"for",
"(",
"Point",
"point",
":",
"points",
")",
"if",
"(",
"id",
".",
"equals",
"(",
"point",
".",
"getId",
"(",
")",
")",
")",
"return",
"point",
";",
"return",
"null",
";",
"}"
] | Return the point with the given id
@param id
@return | [
"Return",
"the",
"point",
"with",
"the",
"given",
"id"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/cluster/Cluster.java#L128-L133 |
128,547 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/cluster/Cluster.java | Cluster.removePoint | public Point removePoint(String id) {
Point removePoint = null;
for (Point point : points)
if (id.equals(point.getId()))
removePoint = point;
if (removePoint != null)
points.remove(removePoint);
return removePoint;
} | java | public Point removePoint(String id) {
Point removePoint = null;
for (Point point : points)
if (id.equals(point.getId()))
removePoint = point;
if (removePoint != null)
points.remove(removePoint);
return removePoint;
} | [
"public",
"Point",
"removePoint",
"(",
"String",
"id",
")",
"{",
"Point",
"removePoint",
"=",
"null",
";",
"for",
"(",
"Point",
"point",
":",
"points",
")",
"if",
"(",
"id",
".",
"equals",
"(",
"point",
".",
"getId",
"(",
")",
")",
")",
"removePoint"... | Remove the point and return it
@param id
@return | [
"Remove",
"the",
"point",
"and",
"return",
"it"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/cluster/Cluster.java#L140-L148 |
128,548 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/memory/MemoryReport.java | MemoryReport.cacheModeMapFor | public static Map<CacheMode, Long> cacheModeMapFor(long value) {
if (value == 0) {
return CACHE_MODE_ALL_ZEROS;
}
Map<CacheMode, Long> m = new HashMap<>();
for (CacheMode cm : CacheMode.values()) {
m.put(cm, value);
}
return m;
} | java | public static Map<CacheMode, Long> cacheModeMapFor(long value) {
if (value == 0) {
return CACHE_MODE_ALL_ZEROS;
}
Map<CacheMode, Long> m = new HashMap<>();
for (CacheMode cm : CacheMode.values()) {
m.put(cm, value);
}
return m;
} | [
"public",
"static",
"Map",
"<",
"CacheMode",
",",
"Long",
">",
"cacheModeMapFor",
"(",
"long",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"0",
")",
"{",
"return",
"CACHE_MODE_ALL_ZEROS",
";",
"}",
"Map",
"<",
"CacheMode",
",",
"Long",
">",
"m",
"=",
... | Get a map of CacheMode with all keys associated with the specified value
@param value Value for all keys
@return Map | [
"Get",
"a",
"map",
"of",
"CacheMode",
"with",
"all",
"keys",
"associated",
"with",
"the",
"specified",
"value"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/memory/MemoryReport.java#L188-L197 |
128,549 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/multilayer/SparkDl4jMultiLayer.java | SparkDl4jMultiLayer.predict | public Matrix predict(Matrix features) {
return MLLibUtil.toMatrix(network.output(MLLibUtil.toMatrix(features)));
} | java | public Matrix predict(Matrix features) {
return MLLibUtil.toMatrix(network.output(MLLibUtil.toMatrix(features)));
} | [
"public",
"Matrix",
"predict",
"(",
"Matrix",
"features",
")",
"{",
"return",
"MLLibUtil",
".",
"toMatrix",
"(",
"network",
".",
"output",
"(",
"MLLibUtil",
".",
"toMatrix",
"(",
"features",
")",
")",
")",
";",
"}"
] | Predict the given feature matrix
@param features the given feature matrix
@return the predictions | [
"Predict",
"the",
"given",
"feature",
"matrix"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/multilayer/SparkDl4jMultiLayer.java#L226-L228 |
128,550 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/multilayer/SparkDl4jMultiLayer.java | SparkDl4jMultiLayer.predict | public Vector predict(Vector point) {
return MLLibUtil.toVector(network.output(MLLibUtil.toVector(point)));
} | java | public Vector predict(Vector point) {
return MLLibUtil.toVector(network.output(MLLibUtil.toVector(point)));
} | [
"public",
"Vector",
"predict",
"(",
"Vector",
"point",
")",
"{",
"return",
"MLLibUtil",
".",
"toVector",
"(",
"network",
".",
"output",
"(",
"MLLibUtil",
".",
"toVector",
"(",
"point",
")",
")",
")",
";",
"}"
] | Predict the given vector
@param point the vector to predict
@return the predicted vector | [
"Predict",
"the",
"given",
"vector"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/multilayer/SparkDl4jMultiLayer.java#L237-L239 |
128,551 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/multilayer/SparkDl4jMultiLayer.java | SparkDl4jMultiLayer.fit | public MultiLayerNetwork fit(JavaRDD<DataSet> trainingData) {
if (Nd4j.getExecutioner() instanceof GridExecutioner)
((GridExecutioner) Nd4j.getExecutioner()).flushQueue();
trainingMaster.executeTraining(this, trainingData);
network.incrementEpochCount();
return network;
... | java | public MultiLayerNetwork fit(JavaRDD<DataSet> trainingData) {
if (Nd4j.getExecutioner() instanceof GridExecutioner)
((GridExecutioner) Nd4j.getExecutioner()).flushQueue();
trainingMaster.executeTraining(this, trainingData);
network.incrementEpochCount();
return network;
... | [
"public",
"MultiLayerNetwork",
"fit",
"(",
"JavaRDD",
"<",
"DataSet",
">",
"trainingData",
")",
"{",
"if",
"(",
"Nd4j",
".",
"getExecutioner",
"(",
")",
"instanceof",
"GridExecutioner",
")",
"(",
"(",
"GridExecutioner",
")",
"Nd4j",
".",
"getExecutioner",
"(",... | Fit the DataSet RDD
@param trainingData the training data RDD to fitDataSet
@return the MultiLayerNetwork after training | [
"Fit",
"the",
"DataSet",
"RDD"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/multilayer/SparkDl4jMultiLayer.java#L257-L264 |
128,552 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/multilayer/SparkDl4jMultiLayer.java | SparkDl4jMultiLayer.fitLabeledPoint | public MultiLayerNetwork fitLabeledPoint(JavaRDD<LabeledPoint> rdd) {
int nLayers = network.getLayerWiseConfigurations().getConfs().size();
FeedForwardLayer ffl = (FeedForwardLayer) network.getLayerWiseConfigurations().getConf(nLayers - 1).getLayer();
JavaRDD<DataSet> ds = MLLibUtil.fromLabeledP... | java | public MultiLayerNetwork fitLabeledPoint(JavaRDD<LabeledPoint> rdd) {
int nLayers = network.getLayerWiseConfigurations().getConfs().size();
FeedForwardLayer ffl = (FeedForwardLayer) network.getLayerWiseConfigurations().getConf(nLayers - 1).getLayer();
JavaRDD<DataSet> ds = MLLibUtil.fromLabeledP... | [
"public",
"MultiLayerNetwork",
"fitLabeledPoint",
"(",
"JavaRDD",
"<",
"LabeledPoint",
">",
"rdd",
")",
"{",
"int",
"nLayers",
"=",
"network",
".",
"getLayerWiseConfigurations",
"(",
")",
".",
"getConfs",
"(",
")",
".",
"size",
"(",
")",
";",
"FeedForwardLayer... | Fit a MultiLayerNetwork using Spark MLLib LabeledPoint instances.
This will convert the labeled points to the internal DL4J data format and train the model on that
@param rdd the rdd to fitDataSet
@return the multi layer network that was fitDataSet | [
"Fit",
"a",
"MultiLayerNetwork",
"using",
"Spark",
"MLLib",
"LabeledPoint",
"instances",
".",
"This",
"will",
"convert",
"the",
"labeled",
"points",
"to",
"the",
"internal",
"DL4J",
"data",
"format",
"and",
"train",
"the",
"model",
"on",
"that"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/multilayer/SparkDl4jMultiLayer.java#L319-L324 |
128,553 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/multilayer/SparkDl4jMultiLayer.java | SparkDl4jMultiLayer.fitContinuousLabeledPoint | public MultiLayerNetwork fitContinuousLabeledPoint(JavaRDD<LabeledPoint> rdd) {
return fit(MLLibUtil.fromContinuousLabeledPoint(sc, rdd));
} | java | public MultiLayerNetwork fitContinuousLabeledPoint(JavaRDD<LabeledPoint> rdd) {
return fit(MLLibUtil.fromContinuousLabeledPoint(sc, rdd));
} | [
"public",
"MultiLayerNetwork",
"fitContinuousLabeledPoint",
"(",
"JavaRDD",
"<",
"LabeledPoint",
">",
"rdd",
")",
"{",
"return",
"fit",
"(",
"MLLibUtil",
".",
"fromContinuousLabeledPoint",
"(",
"sc",
",",
"rdd",
")",
")",
";",
"}"
] | Fits a MultiLayerNetwork using Spark MLLib LabeledPoint instances
This will convert labeled points that have continuous labels used for regression to the internal
DL4J data format and train the model on that
@param rdd the javaRDD containing the labeled points
@return a MultiLayerNetwork | [
"Fits",
"a",
"MultiLayerNetwork",
"using",
"Spark",
"MLLib",
"LabeledPoint",
"instances",
"This",
"will",
"convert",
"labeled",
"points",
"that",
"have",
"continuous",
"labels",
"used",
"for",
"regression",
"to",
"the",
"internal",
"DL4J",
"data",
"format",
"and",... | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/impl/multilayer/SparkDl4jMultiLayer.java#L333-L335 |
128,554 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/transform/OpPredicate.java | OpPredicate.classEquals | public static OpPredicate classEquals(final Class<?> c){
return new OpPredicate() {
@Override
public boolean matches(SameDiff sameDiff, DifferentialFunction function) {
return function.getClass() == c;
}
};
} | java | public static OpPredicate classEquals(final Class<?> c){
return new OpPredicate() {
@Override
public boolean matches(SameDiff sameDiff, DifferentialFunction function) {
return function.getClass() == c;
}
};
} | [
"public",
"static",
"OpPredicate",
"classEquals",
"(",
"final",
"Class",
"<",
"?",
">",
"c",
")",
"{",
"return",
"new",
"OpPredicate",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"matches",
"(",
"SameDiff",
"sameDiff",
",",
"DifferentialFunction",
"... | Return true if the operation class is equal to the specified class | [
"Return",
"true",
"if",
"the",
"operation",
"class",
"is",
"equal",
"to",
"the",
"specified",
"class"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/transform/OpPredicate.java#L90-L97 |
128,555 | deeplearning4j/deeplearning4j | nd4j/nd4j-serde/nd4j-aeron/src/main/java/org/nd4j/aeron/ipc/AeronNDArraySerde.java | AeronNDArraySerde.getDirectByteBuffer | public static ByteBuffer getDirectByteBuffer(DirectBuffer directBuffer) {
return directBuffer.byteBuffer() == null
? ByteBuffer.allocateDirect(directBuffer.capacity()).put(directBuffer.byteArray())
: directBuffer.byteBuffer();
} | java | public static ByteBuffer getDirectByteBuffer(DirectBuffer directBuffer) {
return directBuffer.byteBuffer() == null
? ByteBuffer.allocateDirect(directBuffer.capacity()).put(directBuffer.byteArray())
: directBuffer.byteBuffer();
} | [
"public",
"static",
"ByteBuffer",
"getDirectByteBuffer",
"(",
"DirectBuffer",
"directBuffer",
")",
"{",
"return",
"directBuffer",
".",
"byteBuffer",
"(",
")",
"==",
"null",
"?",
"ByteBuffer",
".",
"allocateDirect",
"(",
"directBuffer",
".",
"capacity",
"(",
")",
... | Get the direct byte buffer from the given direct buffer
@param directBuffer
@return | [
"Get",
"the",
"direct",
"byte",
"buffer",
"from",
"the",
"given",
"direct",
"buffer"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-serde/nd4j-aeron/src/main/java/org/nd4j/aeron/ipc/AeronNDArraySerde.java#L52-L56 |
128,556 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/trie/PatriciaTrie.java | PatriciaTrie.get | @Override
public V get(Object key) {
// Keys can not be null
if (key == null) {
throw new NullPointerException("Key can not be null");
}
if (!(key instanceof String)) {
throw new ClassCastException("Only String keys are supported -- got " + key.getClass());
... | java | @Override
public V get(Object key) {
// Keys can not be null
if (key == null) {
throw new NullPointerException("Key can not be null");
}
if (!(key instanceof String)) {
throw new ClassCastException("Only String keys are supported -- got " + key.getClass());
... | [
"@",
"Override",
"public",
"V",
"get",
"(",
"Object",
"key",
")",
"{",
"// Keys can not be null",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Key can not be null\"",
")",
";",
"}",
"if",
"(",
"!",
"(",
"key",
... | Get value associated with specified key in this trie
@param key key to retrieve value for
@return value or null if non-existent | [
"Get",
"value",
"associated",
"with",
"specified",
"key",
"in",
"this",
"trie"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/trie/PatriciaTrie.java#L56-L83 |
128,557 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/trie/PatriciaTrie.java | PatriciaTrie.containsKey | @Override
public boolean containsKey(Object key) {
if (key == null) {
throw new NullPointerException("Key can not be null");
}
if (!(key instanceof String)) {
throw new ClassCastException("Only String keys are supported -- got " + key.getClass());
}
r... | java | @Override
public boolean containsKey(Object key) {
if (key == null) {
throw new NullPointerException("Key can not be null");
}
if (!(key instanceof String)) {
throw new ClassCastException("Only String keys are supported -- got " + key.getClass());
}
r... | [
"@",
"Override",
"public",
"boolean",
"containsKey",
"(",
"Object",
"key",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Key can not be null\"",
")",
";",
"}",
"if",
"(",
"!",
"(",
"key",
"instanceof",
... | Test membership in this trie
@param key to test if exists
@return true if trie contains key | [
"Test",
"membership",
"in",
"this",
"trie"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/trie/PatriciaTrie.java#L160-L170 |
128,558 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/trie/PatriciaTrie.java | PatriciaTrie.keySet | @Override
public Set<String> keySet() {
Set<String> keys = new HashSet<>();
keysR(root.getLeft(), -1, keys);
return keys;
} | java | @Override
public Set<String> keySet() {
Set<String> keys = new HashSet<>();
keysR(root.getLeft(), -1, keys);
return keys;
} | [
"@",
"Override",
"public",
"Set",
"<",
"String",
">",
"keySet",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"keys",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"keysR",
"(",
"root",
".",
"getLeft",
"(",
")",
",",
"-",
"1",
",",
"keys",
")",
";",
... | Returns a copy of the keys contained in this trie as a Set
@return keys in the trie, not null | [
"Returns",
"a",
"copy",
"of",
"the",
"keys",
"contained",
"in",
"this",
"trie",
"as",
"a",
"Set"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/trie/PatriciaTrie.java#L177-L182 |
128,559 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/trie/PatriciaTrie.java | PatriciaTrie.values | @Override
public Collection<V> values() {
List<V> values = new ArrayList<>();
valuesR(root.getLeft(), -1, values);
return values;
} | java | @Override
public Collection<V> values() {
List<V> values = new ArrayList<>();
valuesR(root.getLeft(), -1, values);
return values;
} | [
"@",
"Override",
"public",
"Collection",
"<",
"V",
">",
"values",
"(",
")",
"{",
"List",
"<",
"V",
">",
"values",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"valuesR",
"(",
"root",
".",
"getLeft",
"(",
")",
",",
"-",
"1",
",",
"values",
")",
... | Returns a copy of the values contained in this trie as a Set
@return values in the trie, not null | [
"Returns",
"a",
"copy",
"of",
"the",
"values",
"contained",
"in",
"this",
"trie",
"as",
"a",
"Set"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/trie/PatriciaTrie.java#L189-L194 |
128,560 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/trie/PatriciaTrie.java | PatriciaTrie.clear | @Override
public void clear() {
root = new PatriciaNode<>(null, null, -1);
root.setLeft(root);
entries = 0;
} | java | @Override
public void clear() {
root = new PatriciaNode<>(null, null, -1);
root.setLeft(root);
entries = 0;
} | [
"@",
"Override",
"public",
"void",
"clear",
"(",
")",
"{",
"root",
"=",
"new",
"PatriciaNode",
"<>",
"(",
"null",
",",
"null",
",",
"-",
"1",
")",
";",
"root",
".",
"setLeft",
"(",
"root",
")",
";",
"entries",
"=",
"0",
";",
"}"
] | Clears this trie by removing all its key-value pairs | [
"Clears",
"this",
"trie",
"by",
"removing",
"all",
"its",
"key",
"-",
"value",
"pairs"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/trie/PatriciaTrie.java#L252-L257 |
128,561 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/trie/PatriciaTrie.java | PatriciaTrie.containsValue | @Override
public boolean containsValue(Object value) {
for (V v : values()) {
if (v.equals(value)) {
return true;
}
}
return false;
} | java | @Override
public boolean containsValue(Object value) {
for (V v : values()) {
if (v.equals(value)) {
return true;
}
}
return false;
} | [
"@",
"Override",
"public",
"boolean",
"containsValue",
"(",
"Object",
"value",
")",
"{",
"for",
"(",
"V",
"v",
":",
"values",
"(",
")",
")",
"{",
"if",
"(",
"v",
".",
"equals",
"(",
"value",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return... | Predicate to test value membership
@param value value to test if is contained in the trie
@return true if and only if trie contains value | [
"Predicate",
"to",
"test",
"value",
"membership"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/trie/PatriciaTrie.java#L265-L273 |
128,562 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/trie/PatriciaTrie.java | PatriciaTrie.entrySet | @Override
public Set<Entry<String, V>> entrySet() {
HashMap<String, V> entries = new HashMap<>();
entriesR(root.getLeft(), -1, entries);
return entries.entrySet();
} | java | @Override
public Set<Entry<String, V>> entrySet() {
HashMap<String, V> entries = new HashMap<>();
entriesR(root.getLeft(), -1, entries);
return entries.entrySet();
} | [
"@",
"Override",
"public",
"Set",
"<",
"Entry",
"<",
"String",
",",
"V",
">",
">",
"entrySet",
"(",
")",
"{",
"HashMap",
"<",
"String",
",",
"V",
">",
"entries",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"entriesR",
"(",
"root",
".",
"getLeft",
... | Returns a copy of the mappings contained in this trie as a Set
@return entries in the trie, not null | [
"Returns",
"a",
"copy",
"of",
"the",
"mappings",
"contained",
"in",
"this",
"trie",
"as",
"a",
"Set"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/trie/PatriciaTrie.java#L280-L285 |
128,563 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/trie/PatriciaTrie.java | PatriciaTrie.findNearestNode | private PatriciaNode<V> findNearestNode(String key) {
PatriciaNode<V> current = root.getLeft();
PatriciaNode<V> parent = root;
while (parent.getBit() < current.getBit()) {
parent = current;
if (!keyMapper.isSet(current.getBit(), key)) {
current = current.... | java | private PatriciaNode<V> findNearestNode(String key) {
PatriciaNode<V> current = root.getLeft();
PatriciaNode<V> parent = root;
while (parent.getBit() < current.getBit()) {
parent = current;
if (!keyMapper.isSet(current.getBit(), key)) {
current = current.... | [
"private",
"PatriciaNode",
"<",
"V",
">",
"findNearestNode",
"(",
"String",
"key",
")",
"{",
"PatriciaNode",
"<",
"V",
">",
"current",
"=",
"root",
".",
"getLeft",
"(",
")",
";",
"PatriciaNode",
"<",
"V",
">",
"parent",
"=",
"root",
";",
"while",
"(",
... | Finds the closest node in the trie matching key
@param key key to look up
@return closest node, null null | [
"Finds",
"the",
"closest",
"node",
"in",
"the",
"trie",
"matching",
"key"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/trie/PatriciaTrie.java#L293-L306 |
128,564 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/trie/PatriciaTrie.java | PatriciaTrie.findFirstDifferingBit | private int findFirstDifferingBit(String key1, String key2) {
int bit = 0;
while (keyMapper.isSet(bit, key1) == keyMapper.isSet(bit, key2)) {
bit++;
}
return bit;
} | java | private int findFirstDifferingBit(String key1, String key2) {
int bit = 0;
while (keyMapper.isSet(bit, key1) == keyMapper.isSet(bit, key2)) {
bit++;
}
return bit;
} | [
"private",
"int",
"findFirstDifferingBit",
"(",
"String",
"key1",
",",
"String",
"key2",
")",
"{",
"int",
"bit",
"=",
"0",
";",
"while",
"(",
"keyMapper",
".",
"isSet",
"(",
"bit",
",",
"key1",
")",
"==",
"keyMapper",
".",
"isSet",
"(",
"bit",
",",
"... | Returns the leftmost differing bit index when doing a bitwise comparison of key1 and key2
@param key1 first key to compare
@param key2 second key to compare
@return bit index of first different bit | [
"Returns",
"the",
"leftmost",
"differing",
"bit",
"index",
"when",
"doing",
"a",
"bitwise",
"comparison",
"of",
"key1",
"and",
"key2"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/trie/PatriciaTrie.java#L315-L322 |
128,565 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/trie/PatriciaTrie.java | PatriciaTrie.insertNode | private void insertNode(PatriciaNode<V> node) {
PatriciaNode<V> current = root.getLeft();
PatriciaNode<V> parent = root;
while (parent.getBit() < current.getBit() && current.getBit() < node.getBit()) {
parent = current;
if (!keyMapper.isSet(current.getBit(), node.getKey(... | java | private void insertNode(PatriciaNode<V> node) {
PatriciaNode<V> current = root.getLeft();
PatriciaNode<V> parent = root;
while (parent.getBit() < current.getBit() && current.getBit() < node.getBit()) {
parent = current;
if (!keyMapper.isSet(current.getBit(), node.getKey(... | [
"private",
"void",
"insertNode",
"(",
"PatriciaNode",
"<",
"V",
">",
"node",
")",
"{",
"PatriciaNode",
"<",
"V",
">",
"current",
"=",
"root",
".",
"getLeft",
"(",
")",
";",
"PatriciaNode",
"<",
"V",
">",
"parent",
"=",
"root",
";",
"while",
"(",
"par... | Inserts a node into this trie
@param node node to insert | [
"Inserts",
"a",
"node",
"into",
"this",
"trie"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/trie/PatriciaTrie.java#L329-L355 |
128,566 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/text/documentiterator/LabelsSource.java | LabelsSource.nextLabel | public synchronized String nextLabel() {
if (labels != null) {
return labels.get(((Long) counter.getAndIncrement()).intValue());
} else {
maxCount = counter.getAndIncrement();
return formatLabel(maxCount);
}
} | java | public synchronized String nextLabel() {
if (labels != null) {
return labels.get(((Long) counter.getAndIncrement()).intValue());
} else {
maxCount = counter.getAndIncrement();
return formatLabel(maxCount);
}
} | [
"public",
"synchronized",
"String",
"nextLabel",
"(",
")",
"{",
"if",
"(",
"labels",
"!=",
"null",
")",
"{",
"return",
"labels",
".",
"get",
"(",
"(",
"(",
"Long",
")",
"counter",
".",
"getAndIncrement",
"(",
")",
")",
".",
"intValue",
"(",
")",
")",... | Returns next label.
@return next label, generated or predefined one | [
"Returns",
"next",
"label",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/text/documentiterator/LabelsSource.java#L88-L95 |
128,567 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/text/documentiterator/LabelsSource.java | LabelsSource.getLabels | public List<String> getLabels() {
if (labels != null && !labels.isEmpty())
return labels;
else {
List<String> result = new ArrayList<>();
for (long x = 0; x < counter.get(); x++)
result.add(formatLabel(x));
return result;
}
} | java | public List<String> getLabels() {
if (labels != null && !labels.isEmpty())
return labels;
else {
List<String> result = new ArrayList<>();
for (long x = 0; x < counter.get(); x++)
result.add(formatLabel(x));
return result;
}
} | [
"public",
"List",
"<",
"String",
">",
"getLabels",
"(",
")",
"{",
"if",
"(",
"labels",
"!=",
"null",
"&&",
"!",
"labels",
".",
"isEmpty",
"(",
")",
")",
"return",
"labels",
";",
"else",
"{",
"List",
"<",
"String",
">",
"result",
"=",
"new",
"ArrayL... | This method returns the list of labels used by this generator instance.
If external list os labels was used as source, whole list will be returned.
@return list of labels | [
"This",
"method",
"returns",
"the",
"list",
"of",
"labels",
"used",
"by",
"this",
"generator",
"instance",
".",
"If",
"external",
"list",
"os",
"labels",
"was",
"used",
"as",
"source",
"whole",
"list",
"will",
"be",
"returned",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/text/documentiterator/LabelsSource.java#L110-L119 |
128,568 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/text/documentiterator/LabelsSource.java | LabelsSource.storeLabel | public void storeLabel(String label) {
if (labels == null)
labels = new ArrayList<>();
if (!uniq.contains(label)) {
uniq.add(label);
labels.add(label);
}
} | java | public void storeLabel(String label) {
if (labels == null)
labels = new ArrayList<>();
if (!uniq.contains(label)) {
uniq.add(label);
labels.add(label);
}
} | [
"public",
"void",
"storeLabel",
"(",
"String",
"label",
")",
"{",
"if",
"(",
"labels",
"==",
"null",
")",
"labels",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"!",
"uniq",
".",
"contains",
"(",
"label",
")",
")",
"{",
"uniq",
".",
"... | This method is intended for storing labels retrieved from external sources.
@param label | [
"This",
"method",
"is",
"intended",
"for",
"storing",
"labels",
"retrieved",
"from",
"external",
"sources",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/text/documentiterator/LabelsSource.java#L126-L134 |
128,569 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/text/documentiterator/LabelsSource.java | LabelsSource.getNumberOfLabelsUsed | public int getNumberOfLabelsUsed() {
if (labels != null && !labels.isEmpty())
return labels.size();
else
return ((Long) (maxCount + 1)).intValue();
} | java | public int getNumberOfLabelsUsed() {
if (labels != null && !labels.isEmpty())
return labels.size();
else
return ((Long) (maxCount + 1)).intValue();
} | [
"public",
"int",
"getNumberOfLabelsUsed",
"(",
")",
"{",
"if",
"(",
"labels",
"!=",
"null",
"&&",
"!",
"labels",
".",
"isEmpty",
"(",
")",
")",
"return",
"labels",
".",
"size",
"(",
")",
";",
"else",
"return",
"(",
"(",
"Long",
")",
"(",
"maxCount",
... | This method returns number of labels used up to the method's call
@return | [
"This",
"method",
"returns",
"number",
"of",
"labels",
"used",
"up",
"to",
"the",
"method",
"s",
"call"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/text/documentiterator/LabelsSource.java#L148-L153 |
128,570 | deeplearning4j/deeplearning4j | arbiter/arbiter-ui/src/main/java/org/deeplearning4j/arbiter/ui/misc/UIUtils.java | UIUtils.formatDuration | public static String formatDuration(long durationMs){
Period period = Period.seconds((int)(durationMs/1000L));
Period p2 = period.normalizedStandard(PeriodType.yearMonthDayTime());
PeriodFormatter formatter = new PeriodFormatterBuilder()
.appendYears()
.appendSuf... | java | public static String formatDuration(long durationMs){
Period period = Period.seconds((int)(durationMs/1000L));
Period p2 = period.normalizedStandard(PeriodType.yearMonthDayTime());
PeriodFormatter formatter = new PeriodFormatterBuilder()
.appendYears()
.appendSuf... | [
"public",
"static",
"String",
"formatDuration",
"(",
"long",
"durationMs",
")",
"{",
"Period",
"period",
"=",
"Period",
".",
"seconds",
"(",
"(",
"int",
")",
"(",
"durationMs",
"/",
"1000L",
")",
")",
";",
"Period",
"p2",
"=",
"period",
".",
"normalizedS... | Format the duration in milliseconds to a human readable String, with "yr", "days", "hr" etc prefixes
@param durationMs Duration in milliseconds
@return Human readable string | [
"Format",
"the",
"duration",
"in",
"milliseconds",
"to",
"a",
"human",
"readable",
"String",
"with",
"yr",
"days",
"hr",
"etc",
"prefixes"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/arbiter/arbiter-ui/src/main/java/org/deeplearning4j/arbiter/ui/misc/UIUtils.java#L91-L111 |
128,571 | deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/transform/PipelineImageTransform.java | PipelineImageTransform.doTransform | @Override
protected ImageWritable doTransform(ImageWritable image, Random random) {
if (shuffle) {
Collections.shuffle(imageTransforms);
}
currentTransforms.clear();
// execute each item in the pipeline
for (Pair<ImageTransform, Double> tuple : imageTransforms) ... | java | @Override
protected ImageWritable doTransform(ImageWritable image, Random random) {
if (shuffle) {
Collections.shuffle(imageTransforms);
}
currentTransforms.clear();
// execute each item in the pipeline
for (Pair<ImageTransform, Double> tuple : imageTransforms) ... | [
"@",
"Override",
"protected",
"ImageWritable",
"doTransform",
"(",
"ImageWritable",
"image",
",",
"Random",
"random",
")",
"{",
"if",
"(",
"shuffle",
")",
"{",
"Collections",
".",
"shuffle",
"(",
"imageTransforms",
")",
";",
"}",
"currentTransforms",
".",
"cle... | Takes an image and executes a pipeline of combined transforms.
@param image to transform, null == end of stream
@param random object to use (or null for deterministic)
@return transformed image | [
"Takes",
"an",
"image",
"and",
"executes",
"a",
"pipeline",
"of",
"combined",
"transforms",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/transform/PipelineImageTransform.java#L105-L123 |
128,572 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/solvers/accumulation/IndexedTail.java | IndexedTail.maintenance | protected synchronized void maintenance() {
// first of all we're checking, if all consumers were already registered. if not - just no-op.
if (positions.size() < expectedConsumers) {
log.trace("Skipping maintanance due to not all expected consumers shown up: [{}] vs [{}]", positions.size(), ... | java | protected synchronized void maintenance() {
// first of all we're checking, if all consumers were already registered. if not - just no-op.
if (positions.size() < expectedConsumers) {
log.trace("Skipping maintanance due to not all expected consumers shown up: [{}] vs [{}]", positions.size(), ... | [
"protected",
"synchronized",
"void",
"maintenance",
"(",
")",
"{",
"// first of all we're checking, if all consumers were already registered. if not - just no-op.",
"if",
"(",
"positions",
".",
"size",
"(",
")",
"<",
"expectedConsumers",
")",
"{",
"log",
".",
"trace",
"("... | This method does maintenance of updates within | [
"This",
"method",
"does",
"maintenance",
"of",
"updates",
"within"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/solvers/accumulation/IndexedTail.java#L296-L323 |
128,573 | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/Counter.java | Counter.incrementAll | public void incrementAll(Collection<T> elements, double inc) {
for (T element: elements) {
incrementCount(element, inc);
}
} | java | public void incrementAll(Collection<T> elements, double inc) {
for (T element: elements) {
incrementCount(element, inc);
}
} | [
"public",
"void",
"incrementAll",
"(",
"Collection",
"<",
"T",
">",
"elements",
",",
"double",
"inc",
")",
"{",
"for",
"(",
"T",
"element",
":",
"elements",
")",
"{",
"incrementCount",
"(",
"element",
",",
"inc",
")",
";",
"}",
"}"
] | This method will increment all elements in collection
@param elements
@param inc | [
"This",
"method",
"will",
"increment",
"all",
"elements",
"in",
"collection"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/Counter.java#L64-L68 |
128,574 | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/Counter.java | Counter.incrementAll | public <T2 extends T> void incrementAll(Counter<T2> other) {
for (T2 element: other.keySet()) {
double cnt = other.getCount(element);
incrementCount(element, cnt);
}
} | java | public <T2 extends T> void incrementAll(Counter<T2> other) {
for (T2 element: other.keySet()) {
double cnt = other.getCount(element);
incrementCount(element, cnt);
}
} | [
"public",
"<",
"T2",
"extends",
"T",
">",
"void",
"incrementAll",
"(",
"Counter",
"<",
"T2",
">",
"other",
")",
"{",
"for",
"(",
"T2",
"element",
":",
"other",
".",
"keySet",
"(",
")",
")",
"{",
"double",
"cnt",
"=",
"other",
".",
"getCount",
"(",
... | This method will increment counts of this counter by counts from other counter
@param other | [
"This",
"method",
"will",
"increment",
"counts",
"of",
"this",
"counter",
"by",
"counts",
"from",
"other",
"counter"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/Counter.java#L74-L79 |
128,575 | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/Counter.java | Counter.setCount | public double setCount(T element, double count) {
AtomicDouble t = map.get(element);
if (t != null) {
double val = t.getAndSet(count);
dirty.set(true);
return val;
} else {
map.put(element, new AtomicDouble(count));
totalCount.addAndGet... | java | public double setCount(T element, double count) {
AtomicDouble t = map.get(element);
if (t != null) {
double val = t.getAndSet(count);
dirty.set(true);
return val;
} else {
map.put(element, new AtomicDouble(count));
totalCount.addAndGet... | [
"public",
"double",
"setCount",
"(",
"T",
"element",
",",
"double",
"count",
")",
"{",
"AtomicDouble",
"t",
"=",
"map",
".",
"get",
"(",
"element",
")",
";",
"if",
"(",
"t",
"!=",
"null",
")",
"{",
"double",
"val",
"=",
"t",
".",
"getAndSet",
"(",
... | This method sets new counter value for given element
@param element element to be updated
@param count new counter value
@return previous value | [
"This",
"method",
"sets",
"new",
"counter",
"value",
"for",
"given",
"element"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/Counter.java#L101-L113 |
128,576 | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/Counter.java | Counter.keySetSorted | public List<T> keySetSorted() {
List<T> result = new ArrayList<>();
PriorityQueue<Pair<T, Double>> pq = asPriorityQueue();
while (!pq.isEmpty()) {
result.add(pq.poll().getFirst());
}
return result;
} | java | public List<T> keySetSorted() {
List<T> result = new ArrayList<>();
PriorityQueue<Pair<T, Double>> pq = asPriorityQueue();
while (!pq.isEmpty()) {
result.add(pq.poll().getFirst());
}
return result;
} | [
"public",
"List",
"<",
"T",
">",
"keySetSorted",
"(",
")",
"{",
"List",
"<",
"T",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"PriorityQueue",
"<",
"Pair",
"<",
"T",
",",
"Double",
">",
">",
"pq",
"=",
"asPriorityQueue",
"(",
")",
... | This method returns List of elements, sorted by their counts
@return | [
"This",
"method",
"returns",
"List",
"of",
"elements",
"sorted",
"by",
"their",
"counts"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/Counter.java#L145-L154 |
128,577 | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/Counter.java | Counter.normalize | public void normalize() {
for (T key : keySet()) {
setCount(key, getCount(key) / totalCount.get());
}
rebuildTotals();
} | java | public void normalize() {
for (T key : keySet()) {
setCount(key, getCount(key) / totalCount.get());
}
rebuildTotals();
} | [
"public",
"void",
"normalize",
"(",
")",
"{",
"for",
"(",
"T",
"key",
":",
"keySet",
"(",
")",
")",
"{",
"setCount",
"(",
"key",
",",
"getCount",
"(",
"key",
")",
"/",
"totalCount",
".",
"get",
"(",
")",
")",
";",
"}",
"rebuildTotals",
"(",
")",
... | This method will apply normalization to counter values and totals. | [
"This",
"method",
"will",
"apply",
"normalization",
"to",
"counter",
"values",
"and",
"totals",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/Counter.java#L159-L165 |
128,578 | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/Counter.java | Counter.removeKey | public double removeKey(T element) {
AtomicDouble v = map.remove(element);
dirty.set(true);
if (v != null)
return v.get();
else
return 0.0;
} | java | public double removeKey(T element) {
AtomicDouble v = map.remove(element);
dirty.set(true);
if (v != null)
return v.get();
else
return 0.0;
} | [
"public",
"double",
"removeKey",
"(",
"T",
"element",
")",
"{",
"AtomicDouble",
"v",
"=",
"map",
".",
"remove",
"(",
"element",
")",
";",
"dirty",
".",
"set",
"(",
"true",
")",
";",
"if",
"(",
"v",
"!=",
"null",
")",
"return",
"v",
".",
"get",
"(... | This method removes given key from counter
@param element
@return counter value | [
"This",
"method",
"removes",
"given",
"key",
"from",
"counter"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/Counter.java#L193-L201 |
128,579 | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/Counter.java | Counter.argMax | public T argMax() {
double maxCount = -Double.MAX_VALUE;
T maxKey = null;
for (Map.Entry<T, AtomicDouble> entry : map.entrySet()) {
if (entry.getValue().get() > maxCount || maxKey == null) {
maxKey = entry.getKey();
maxCount = entry.getValue().get();
... | java | public T argMax() {
double maxCount = -Double.MAX_VALUE;
T maxKey = null;
for (Map.Entry<T, AtomicDouble> entry : map.entrySet()) {
if (entry.getValue().get() > maxCount || maxKey == null) {
maxKey = entry.getKey();
maxCount = entry.getValue().get();
... | [
"public",
"T",
"argMax",
"(",
")",
"{",
"double",
"maxCount",
"=",
"-",
"Double",
".",
"MAX_VALUE",
";",
"T",
"maxKey",
"=",
"null",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"T",
",",
"AtomicDouble",
">",
"entry",
":",
"map",
".",
"entrySet",
"("... | This method returns element with highest counter value
@return | [
"This",
"method",
"returns",
"element",
"with",
"highest",
"counter",
"value"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/Counter.java#L208-L218 |
128,580 | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/Counter.java | Counter.dropElementsBelowThreshold | public void dropElementsBelowThreshold(double threshold) {
Iterator<T> iterator = keySet().iterator();
while (iterator.hasNext()) {
T element = iterator.next();
double val = map.get(element).get();
if (val < threshold) {
iterator.remove();
... | java | public void dropElementsBelowThreshold(double threshold) {
Iterator<T> iterator = keySet().iterator();
while (iterator.hasNext()) {
T element = iterator.next();
double val = map.get(element).get();
if (val < threshold) {
iterator.remove();
... | [
"public",
"void",
"dropElementsBelowThreshold",
"(",
"double",
"threshold",
")",
"{",
"Iterator",
"<",
"T",
">",
"iterator",
"=",
"keySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"T",
"el... | This method will remove all elements with counts below given threshold from counter
@param threshold | [
"This",
"method",
"will",
"remove",
"all",
"elements",
"with",
"counts",
"below",
"given",
"threshold",
"from",
"counter"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/Counter.java#L224-L235 |
128,581 | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/Counter.java | Counter.keepTopNElements | public void keepTopNElements(int N){
PriorityQueue<Pair<T, Double>> queue = asPriorityQueue();
clear();
for (int e = 0; e < N; e++) {
Pair<T, Double> pair = queue.poll();
if (pair != null)
incrementCount(pair.getFirst(), pair.getSecond());
}
} | java | public void keepTopNElements(int N){
PriorityQueue<Pair<T, Double>> queue = asPriorityQueue();
clear();
for (int e = 0; e < N; e++) {
Pair<T, Double> pair = queue.poll();
if (pair != null)
incrementCount(pair.getFirst(), pair.getSecond());
}
} | [
"public",
"void",
"keepTopNElements",
"(",
"int",
"N",
")",
"{",
"PriorityQueue",
"<",
"Pair",
"<",
"T",
",",
"Double",
">",
">",
"queue",
"=",
"asPriorityQueue",
"(",
")",
";",
"clear",
"(",
")",
";",
"for",
"(",
"int",
"e",
"=",
"0",
";",
"e",
... | This method removes all elements except of top N by counter values
@param N | [
"This",
"method",
"removes",
"all",
"elements",
"except",
"of",
"top",
"N",
"by",
"counter",
"values"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/Counter.java#L282-L290 |
128,582 | deeplearning4j/deeplearning4j | rl4j/rl4j-core/src/main/java/org/deeplearning4j/rl4j/learning/async/nstep/discrete/AsyncNStepQLearningThreadDiscrete.java | AsyncNStepQLearningThreadDiscrete.calcGradient | public Gradient[] calcGradient(IDQN current, Stack<MiniTrans<Integer>> rewards) {
MiniTrans<Integer> minTrans = rewards.pop();
int size = rewards.size();
int[] shape = getHistoryProcessor() == null ? mdp.getObservationSpace().getShape()
: getHistoryProcessor().getConf(... | java | public Gradient[] calcGradient(IDQN current, Stack<MiniTrans<Integer>> rewards) {
MiniTrans<Integer> minTrans = rewards.pop();
int size = rewards.size();
int[] shape = getHistoryProcessor() == null ? mdp.getObservationSpace().getShape()
: getHistoryProcessor().getConf(... | [
"public",
"Gradient",
"[",
"]",
"calcGradient",
"(",
"IDQN",
"current",
",",
"Stack",
"<",
"MiniTrans",
"<",
"Integer",
">",
">",
"rewards",
")",
"{",
"MiniTrans",
"<",
"Integer",
">",
"minTrans",
"=",
"rewards",
".",
"pop",
"(",
")",
";",
"int",
"size... | calc the gradient based on the n-step rewards | [
"calc",
"the",
"gradient",
"based",
"on",
"the",
"n",
"-",
"step",
"rewards"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/rl4j/rl4j-core/src/main/java/org/deeplearning4j/rl4j/learning/async/nstep/discrete/AsyncNStepQLearningThreadDiscrete.java#L78-L102 |
128,583 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java | KerasLayerUtils.checkForUnsupportedConfigurations | public static void checkForUnsupportedConfigurations(Map<String, Object> layerConfig,
boolean enforceTrainingConfig,
KerasLayerConfiguration conf)
throws UnsupportedKerasConfigurationException, ... | java | public static void checkForUnsupportedConfigurations(Map<String, Object> layerConfig,
boolean enforceTrainingConfig,
KerasLayerConfiguration conf)
throws UnsupportedKerasConfigurationException, ... | [
"public",
"static",
"void",
"checkForUnsupportedConfigurations",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
",",
"boolean",
"enforceTrainingConfig",
",",
"KerasLayerConfiguration",
"conf",
")",
"throws",
"UnsupportedKerasConfigurationException",
",",
"I... | Checks whether layer config contains unsupported options.
@param layerConfig dictionary containing Keras layer configuration
@param enforceTrainingConfig whether to use Keras training configuration
@throws InvalidKerasConfigurationException Invalid Keras config
@throws UnsupportedKerasConfigurationExcept... | [
"Checks",
"whether",
"layer",
"config",
"contains",
"unsupported",
"options",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java#L70-L85 |
128,584 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java | KerasLayerUtils.checkForUnknownRegularizer | private static void checkForUnknownRegularizer(Map<String, Object> regularizerConfig, boolean enforceTrainingConfig,
KerasLayerConfiguration conf)
throws UnsupportedKerasConfigurationException {
if (regularizerConfig != null) {
for (Stri... | java | private static void checkForUnknownRegularizer(Map<String, Object> regularizerConfig, boolean enforceTrainingConfig,
KerasLayerConfiguration conf)
throws UnsupportedKerasConfigurationException {
if (regularizerConfig != null) {
for (Stri... | [
"private",
"static",
"void",
"checkForUnknownRegularizer",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"regularizerConfig",
",",
"boolean",
"enforceTrainingConfig",
",",
"KerasLayerConfiguration",
"conf",
")",
"throws",
"UnsupportedKerasConfigurationException",
"{",
"i... | Check whether Keras weight regularization is of unknown type. Currently prints a warning
since main use case for model import is inference, not further training. Unlikely since
standard Keras weight regularizers are L1 and L2.
@param regularizerConfig Map containing Keras weight reguarlization configuration | [
"Check",
"whether",
"Keras",
"weight",
"regularization",
"is",
"of",
"unknown",
"type",
".",
"Currently",
"prints",
"a",
"warning",
"since",
"main",
"use",
"case",
"for",
"model",
"import",
"is",
"inference",
"not",
"further",
"training",
".",
"Unlikely",
"sin... | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java#L134-L150 |
128,585 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java | KerasLayerUtils.getKerasLayerFromConfig | public static KerasLayer getKerasLayerFromConfig(Map<String, Object> layerConfig,
KerasLayerConfiguration conf,
Map<String, Class<? extends KerasLayer>> customLayers,
... | java | public static KerasLayer getKerasLayerFromConfig(Map<String, Object> layerConfig,
KerasLayerConfiguration conf,
Map<String, Class<? extends KerasLayer>> customLayers,
... | [
"public",
"static",
"KerasLayer",
"getKerasLayerFromConfig",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
",",
"KerasLayerConfiguration",
"conf",
",",
"Map",
"<",
"String",
",",
"Class",
"<",
"?",
"extends",
"KerasLayer",
">",
">",
"customLayers... | Build KerasLayer from a Keras layer configuration.
@param layerConfig map containing Keras layer properties
@return KerasLayer
@see Layer | [
"Build",
"KerasLayer",
"from",
"a",
"Keras",
"layer",
"configuration",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java#L160-L167 |
128,586 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java | KerasLayerUtils.getClassNameFromConfig | public static String getClassNameFromConfig(Map<String, Object> layerConfig, KerasLayerConfiguration conf)
throws InvalidKerasConfigurationException {
if (!layerConfig.containsKey(conf.getLAYER_FIELD_CLASS_NAME()))
throw new InvalidKerasConfigurationException(
"Field ... | java | public static String getClassNameFromConfig(Map<String, Object> layerConfig, KerasLayerConfiguration conf)
throws InvalidKerasConfigurationException {
if (!layerConfig.containsKey(conf.getLAYER_FIELD_CLASS_NAME()))
throw new InvalidKerasConfigurationException(
"Field ... | [
"public",
"static",
"String",
"getClassNameFromConfig",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
",",
"KerasLayerConfiguration",
"conf",
")",
"throws",
"InvalidKerasConfigurationException",
"{",
"if",
"(",
"!",
"layerConfig",
".",
"containsKey",
... | Get Keras layer class name from Keras layer configuration.
@param layerConfig dictionary containing Keras layer configuration
@return Keras layer class name
@throws InvalidKerasConfigurationException Invalid Keras config | [
"Get",
"Keras",
"layer",
"class",
"name",
"from",
"Keras",
"layer",
"configuration",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java#L338-L344 |
128,587 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java | KerasLayerUtils.getTimeDistributedLayerConfig | public static Map<String, Object> getTimeDistributedLayerConfig(Map<String, Object> layerConfig,
KerasLayerConfiguration conf)
throws InvalidKerasConfigurationException {
if (!layerConfig.containsKey(conf.getLAYER_FIELD_CLASS_NAME()... | java | public static Map<String, Object> getTimeDistributedLayerConfig(Map<String, Object> layerConfig,
KerasLayerConfiguration conf)
throws InvalidKerasConfigurationException {
if (!layerConfig.containsKey(conf.getLAYER_FIELD_CLASS_NAME()... | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"getTimeDistributedLayerConfig",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
",",
"KerasLayerConfiguration",
"conf",
")",
"throws",
"InvalidKerasConfigurationException",
"{",
"if",
"(",
... | Extract inner layer config from TimeDistributed configuration and merge
it into the outer config.
@param layerConfig dictionary containing Keras TimeDistributed configuration
@return Time distributed layer config
@throws InvalidKerasConfigurationException Invalid Keras config | [
"Extract",
"inner",
"layer",
"config",
"from",
"TimeDistributed",
"configuration",
"and",
"merge",
"it",
"into",
"the",
"outer",
"config",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java#L354-L374 |
128,588 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java | KerasLayerUtils.getInnerLayerConfigFromConfig | public static Map<String, Object> getInnerLayerConfigFromConfig(Map<String, Object> layerConfig, KerasLayerConfiguration conf)
throws InvalidKerasConfigurationException {
if (!layerConfig.containsKey(conf.getLAYER_FIELD_CONFIG()))
throw new InvalidKerasConfigurationException("Field "
... | java | public static Map<String, Object> getInnerLayerConfigFromConfig(Map<String, Object> layerConfig, KerasLayerConfiguration conf)
throws InvalidKerasConfigurationException {
if (!layerConfig.containsKey(conf.getLAYER_FIELD_CONFIG()))
throw new InvalidKerasConfigurationException("Field "
... | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"getInnerLayerConfigFromConfig",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
",",
"KerasLayerConfiguration",
"conf",
")",
"throws",
"InvalidKerasConfigurationException",
"{",
"if",
"(",
... | Get inner layer config from Keras layer configuration.
@param layerConfig dictionary containing Keras layer configuration
@return Inner layer config for a nested Keras layer configuration
@throws InvalidKerasConfigurationException Invalid Keras config | [
"Get",
"inner",
"layer",
"config",
"from",
"Keras",
"layer",
"configuration",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java#L383-L389 |
128,589 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java | KerasLayerUtils.getLayerNameFromConfig | public static String getLayerNameFromConfig(Map<String, Object> layerConfig,
KerasLayerConfiguration conf)
throws InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
... | java | public static String getLayerNameFromConfig(Map<String, Object> layerConfig,
KerasLayerConfiguration conf)
throws InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
... | [
"public",
"static",
"String",
"getLayerNameFromConfig",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
",",
"KerasLayerConfiguration",
"conf",
")",
"throws",
"InvalidKerasConfigurationException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"innerCo... | Get layer name from Keras layer configuration.
@param layerConfig dictionary containing Keras layer configuration
@return Keras layer name
@throws InvalidKerasConfigurationException Invalid Keras config | [
"Get",
"layer",
"name",
"from",
"Keras",
"layer",
"configuration",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java#L398-L406 |
128,590 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java | KerasLayerUtils.getInputShapeFromConfig | public static int[] getInputShapeFromConfig(Map<String, Object> layerConfig,
KerasLayerConfiguration conf)
throws InvalidKerasConfigurationException {
// TODO: validate this. shouldn't we also have INPUT_SHAPE checked?
Map<String, Object> inner... | java | public static int[] getInputShapeFromConfig(Map<String, Object> layerConfig,
KerasLayerConfiguration conf)
throws InvalidKerasConfigurationException {
// TODO: validate this. shouldn't we also have INPUT_SHAPE checked?
Map<String, Object> inner... | [
"public",
"static",
"int",
"[",
"]",
"getInputShapeFromConfig",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
",",
"KerasLayerConfiguration",
"conf",
")",
"throws",
"InvalidKerasConfigurationException",
"{",
"// TODO: validate this. shouldn't we also have IN... | Get Keras input shape from Keras layer configuration.
@param layerConfig dictionary containing Keras layer configuration
@return input shape array | [
"Get",
"Keras",
"input",
"shape",
"from",
"Keras",
"layer",
"configuration",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java#L414-L427 |
128,591 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java | KerasLayerUtils.getInboundLayerNamesFromConfig | public static List<String> getInboundLayerNamesFromConfig(Map<String, Object> layerConfig, KerasLayerConfiguration conf) {
List<String> inboundLayerNames = new ArrayList<>();
if (layerConfig.containsKey(conf.getLAYER_FIELD_INBOUND_NODES())) {
List<Object> inboundNodes = (List<Object>) layerC... | java | public static List<String> getInboundLayerNamesFromConfig(Map<String, Object> layerConfig, KerasLayerConfiguration conf) {
List<String> inboundLayerNames = new ArrayList<>();
if (layerConfig.containsKey(conf.getLAYER_FIELD_INBOUND_NODES())) {
List<Object> inboundNodes = (List<Object>) layerC... | [
"public",
"static",
"List",
"<",
"String",
">",
"getInboundLayerNamesFromConfig",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
",",
"KerasLayerConfiguration",
"conf",
")",
"{",
"List",
"<",
"String",
">",
"inboundLayerNames",
"=",
"new",
"ArrayL... | Get list of inbound layers from Keras layer configuration.
@param layerConfig dictionary containing Keras layer configuration
@return List of inbound layer names | [
"Get",
"list",
"of",
"inbound",
"layers",
"from",
"Keras",
"layer",
"configuration",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java#L467-L480 |
128,592 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java | KerasLayerUtils.getNOutFromConfig | public static int getNOutFromConfig(Map<String, Object> layerConfig,
KerasLayerConfiguration conf) throws InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
int nOut;
if ... | java | public static int getNOutFromConfig(Map<String, Object> layerConfig,
KerasLayerConfiguration conf) throws InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
int nOut;
if ... | [
"public",
"static",
"int",
"getNOutFromConfig",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
",",
"KerasLayerConfiguration",
"conf",
")",
"throws",
"InvalidKerasConfigurationException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"innerConfig",
... | Get number of outputs from Keras layer configuration.
@param layerConfig dictionary containing Keras layer configuration
@return Number of output neurons of the Keras layer
@throws InvalidKerasConfigurationException Invalid Keras config | [
"Get",
"number",
"of",
"outputs",
"from",
"Keras",
"layer",
"configuration",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java#L489-L506 |
128,593 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java | KerasLayerUtils.getDropoutFromConfig | public static double getDropoutFromConfig(Map<String, Object> layerConfig,
KerasLayerConfiguration conf) throws InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
/* NOTE: ... | java | public static double getDropoutFromConfig(Map<String, Object> layerConfig,
KerasLayerConfiguration conf) throws InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
/* NOTE: ... | [
"public",
"static",
"double",
"getDropoutFromConfig",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
",",
"KerasLayerConfiguration",
"conf",
")",
"throws",
"InvalidKerasConfigurationException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"innerConf... | Get dropout from Keras layer configuration.
@param layerConfig dictionary containing Keras layer configuration
@return get dropout value from Keras config
@throws InvalidKerasConfigurationException Invalid Keras config | [
"Get",
"dropout",
"from",
"Keras",
"layer",
"configuration",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java#L515-L540 |
128,594 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java | KerasLayerUtils.getHasBiasFromConfig | public static boolean getHasBiasFromConfig(Map<String, Object> layerConfig,
KerasLayerConfiguration conf)
throws InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
... | java | public static boolean getHasBiasFromConfig(Map<String, Object> layerConfig,
KerasLayerConfiguration conf)
throws InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
... | [
"public",
"static",
"boolean",
"getHasBiasFromConfig",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
",",
"KerasLayerConfiguration",
"conf",
")",
"throws",
"InvalidKerasConfigurationException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"innerCon... | Determine if layer should be instantiated with bias
@param layerConfig dictionary containing Keras layer configuration
@return whether layer has a bias term
@throws InvalidKerasConfigurationException Invalid Keras config | [
"Determine",
"if",
"layer",
"should",
"be",
"instantiated",
"with",
"bias"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java#L549-L558 |
128,595 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java | KerasLayerUtils.getZeroMaskingFromConfig | public static boolean getZeroMaskingFromConfig(Map<String, Object> layerConfig,
KerasLayerConfiguration conf)
throws InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, co... | java | public static boolean getZeroMaskingFromConfig(Map<String, Object> layerConfig,
KerasLayerConfiguration conf)
throws InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, co... | [
"public",
"static",
"boolean",
"getZeroMaskingFromConfig",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
",",
"KerasLayerConfiguration",
"conf",
")",
"throws",
"InvalidKerasConfigurationException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"inne... | Get zero masking flag
@param layerConfig dictionary containing Keras layer configuration
@return if masking zeros or not
@throws InvalidKerasConfigurationException Invalid Keras configuration | [
"Get",
"zero",
"masking",
"flag"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java#L567-L576 |
128,596 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java | KerasLayerUtils.getMaskingValueFromConfig | public static double getMaskingValueFromConfig(Map<String, Object> layerConfig,
KerasLayerConfiguration conf)
throws InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, co... | java | public static double getMaskingValueFromConfig(Map<String, Object> layerConfig,
KerasLayerConfiguration conf)
throws InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, co... | [
"public",
"static",
"double",
"getMaskingValueFromConfig",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
",",
"KerasLayerConfiguration",
"conf",
")",
"throws",
"InvalidKerasConfigurationException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"inne... | Get mask value
@param layerConfig dictionary containing Keras layer configuration
@return mask value, defaults to 0.0
@throws InvalidKerasConfigurationException Invalid Keras configuration | [
"Get",
"mask",
"value"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java#L585-L601 |
128,597 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java | KerasLayerUtils.removeDefaultWeights | public static void removeDefaultWeights(Map<String, INDArray> weights, KerasLayerConfiguration conf) {
if (weights.size() > 2) {
Set<String> paramNames = weights.keySet();
paramNames.remove(conf.getKERAS_PARAM_NAME_W());
paramNames.remove(conf.getKERAS_PARAM_NAME_B());
... | java | public static void removeDefaultWeights(Map<String, INDArray> weights, KerasLayerConfiguration conf) {
if (weights.size() > 2) {
Set<String> paramNames = weights.keySet();
paramNames.remove(conf.getKERAS_PARAM_NAME_W());
paramNames.remove(conf.getKERAS_PARAM_NAME_B());
... | [
"public",
"static",
"void",
"removeDefaultWeights",
"(",
"Map",
"<",
"String",
",",
"INDArray",
">",
"weights",
",",
"KerasLayerConfiguration",
"conf",
")",
"{",
"if",
"(",
"weights",
".",
"size",
"(",
")",
">",
"2",
")",
"{",
"Set",
"<",
"String",
">",
... | Remove weights from config after weight setting.
@param weights layer weights
@param conf Keras layer configuration | [
"Remove",
"weights",
"from",
"config",
"after",
"weight",
"setting",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasLayerUtils.java#L610-L619 |
128,598 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/MultiNormalizerHybrid.java | MultiNormalizerHybrid.minMaxScaleInput | public MultiNormalizerHybrid minMaxScaleInput(int input, double rangeFrom, double rangeTo) {
perInputStrategies.put(input, new MinMaxStrategy(rangeFrom, rangeTo));
return this;
} | java | public MultiNormalizerHybrid minMaxScaleInput(int input, double rangeFrom, double rangeTo) {
perInputStrategies.put(input, new MinMaxStrategy(rangeFrom, rangeTo));
return this;
} | [
"public",
"MultiNormalizerHybrid",
"minMaxScaleInput",
"(",
"int",
"input",
",",
"double",
"rangeFrom",
",",
"double",
"rangeTo",
")",
"{",
"perInputStrategies",
".",
"put",
"(",
"input",
",",
"new",
"MinMaxStrategy",
"(",
"rangeFrom",
",",
"rangeTo",
")",
")",
... | Apply min-max scaling to a specific input, overriding the global input strategy if any
@param input the index of the input
@param rangeFrom lower bound of the target range
@param rangeTo upper bound of the target range
@return the normalizer | [
"Apply",
"min",
"-",
"max",
"scaling",
"to",
"a",
"specific",
"input",
"overriding",
"the",
"global",
"input",
"strategy",
"if",
"any"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/MultiNormalizerHybrid.java#L121-L124 |
128,599 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/MultiNormalizerHybrid.java | MultiNormalizerHybrid.minMaxScaleOutput | public MultiNormalizerHybrid minMaxScaleOutput(int output, double rangeFrom, double rangeTo) {
perOutputStrategies.put(output, new MinMaxStrategy(rangeFrom, rangeTo));
return this;
} | java | public MultiNormalizerHybrid minMaxScaleOutput(int output, double rangeFrom, double rangeTo) {
perOutputStrategies.put(output, new MinMaxStrategy(rangeFrom, rangeTo));
return this;
} | [
"public",
"MultiNormalizerHybrid",
"minMaxScaleOutput",
"(",
"int",
"output",
",",
"double",
"rangeFrom",
",",
"double",
"rangeTo",
")",
"{",
"perOutputStrategies",
".",
"put",
"(",
"output",
",",
"new",
"MinMaxStrategy",
"(",
"rangeFrom",
",",
"rangeTo",
")",
"... | Apply min-max scaling to a specific output, overriding the global output strategy if any
@param output the index of the input
@param rangeFrom lower bound of the target range
@param rangeTo upper bound of the target range
@return the normalizer | [
"Apply",
"min",
"-",
"max",
"scaling",
"to",
"a",
"specific",
"output",
"overriding",
"the",
"global",
"output",
"strategy",
"if",
"any"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/MultiNormalizerHybrid.java#L188-L191 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.