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,300 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/Evaluation.java | Evaluation.confusionToString | public String confusionToString() {
int nClasses = confusion().getClasses().size();
//First: work out the longest label size
int maxLabelSize = 0;
for (String s : labelsList) {
maxLabelSize = Math.max(maxLabelSize, s.length());
}
//Build the formatting for t... | java | public String confusionToString() {
int nClasses = confusion().getClasses().size();
//First: work out the longest label size
int maxLabelSize = 0;
for (String s : labelsList) {
maxLabelSize = Math.max(maxLabelSize, s.length());
}
//Build the formatting for t... | [
"public",
"String",
"confusionToString",
"(",
")",
"{",
"int",
"nClasses",
"=",
"confusion",
"(",
")",
".",
"getClasses",
"(",
")",
".",
"size",
"(",
")",
";",
"//First: work out the longest label size",
"int",
"maxLabelSize",
"=",
"0",
";",
"for",
"(",
"Str... | Get a String representation of the confusion matrix | [
"Get",
"a",
"String",
"representation",
"of",
"the",
"confusion",
"matrix"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/Evaluation.java#L1643-L1695 |
128,301 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/KerasSequentialModel.java | KerasSequentialModel.getMultiLayerConfiguration | public MultiLayerConfiguration getMultiLayerConfiguration()
throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException {
if (!this.className.equals(config.getFieldClassNameSequential()))
throw new InvalidKerasConfigurationException(
"Keras model... | java | public MultiLayerConfiguration getMultiLayerConfiguration()
throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException {
if (!this.className.equals(config.getFieldClassNameSequential()))
throw new InvalidKerasConfigurationException(
"Keras model... | [
"public",
"MultiLayerConfiguration",
"getMultiLayerConfiguration",
"(",
")",
"throws",
"InvalidKerasConfigurationException",
",",
"UnsupportedKerasConfigurationException",
"{",
"if",
"(",
"!",
"this",
".",
"className",
".",
"equals",
"(",
"config",
".",
"getFieldClassNameSe... | Configure a MultiLayerConfiguration from this Keras Sequential model configuration.
@return MultiLayerConfiguration | [
"Configure",
"a",
"MultiLayerConfiguration",
"from",
"this",
"Keras",
"Sequential",
"model",
"configuration",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/KerasSequentialModel.java#L165-L226 |
128,302 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/KerasSequentialModel.java | KerasSequentialModel.getMultiLayerNetwork | public MultiLayerNetwork getMultiLayerNetwork(boolean importWeights)
throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException {
MultiLayerNetwork model = new MultiLayerNetwork(getMultiLayerConfiguration());
model.init();
if (importWeights)
model =... | java | public MultiLayerNetwork getMultiLayerNetwork(boolean importWeights)
throws InvalidKerasConfigurationException, UnsupportedKerasConfigurationException {
MultiLayerNetwork model = new MultiLayerNetwork(getMultiLayerConfiguration());
model.init();
if (importWeights)
model =... | [
"public",
"MultiLayerNetwork",
"getMultiLayerNetwork",
"(",
"boolean",
"importWeights",
")",
"throws",
"InvalidKerasConfigurationException",
",",
"UnsupportedKerasConfigurationException",
"{",
"MultiLayerNetwork",
"model",
"=",
"new",
"MultiLayerNetwork",
"(",
"getMultiLayerConfi... | Build a MultiLayerNetwork from this Keras Sequential model configuration and import weights.
@return MultiLayerNetwork | [
"Build",
"a",
"MultiLayerNetwork",
"from",
"this",
"Keras",
"Sequential",
"model",
"configuration",
"and",
"import",
"weights",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/KerasSequentialModel.java#L243-L250 |
128,303 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/iter/LinearIndexLookup.java | LinearIndexLookup.lookup | public long[] lookup(int index) {
if (exists[index]) {
return indexes[index];
} else {
exists[index] = true;
indexes[index] = ordering == 'c' ? Shape.ind2subC(shape, index, numIndexes)
: Shape.ind2sub(shape, index, numIndexes);
... | java | public long[] lookup(int index) {
if (exists[index]) {
return indexes[index];
} else {
exists[index] = true;
indexes[index] = ordering == 'c' ? Shape.ind2subC(shape, index, numIndexes)
: Shape.ind2sub(shape, index, numIndexes);
... | [
"public",
"long",
"[",
"]",
"lookup",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"exists",
"[",
"index",
"]",
")",
"{",
"return",
"indexes",
"[",
"index",
"]",
";",
"}",
"else",
"{",
"exists",
"[",
"index",
"]",
"=",
"true",
";",
"indexes",
"[",
... | Give back a sub
wrt the given linear index
@param index the index
@return the sub for the given index | [
"Give",
"back",
"a",
"sub",
"wrt",
"the",
"given",
"linear",
"index"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/iter/LinearIndexLookup.java#L61-L70 |
128,304 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/serde/FlatBuffersMapper.java | FlatBuffersMapper.getTypeFromByte | public static Op.Type getTypeFromByte(byte type) {
switch (type) {
case OpType.SCALAR:
return Op.Type.SCALAR;
case OpType.SCALAR_BOOL:
return Op.Type.SCALAR_BOOL;
case OpType.BROADCAST:
return Op.Type.BROADCAST;
case... | java | public static Op.Type getTypeFromByte(byte type) {
switch (type) {
case OpType.SCALAR:
return Op.Type.SCALAR;
case OpType.SCALAR_BOOL:
return Op.Type.SCALAR_BOOL;
case OpType.BROADCAST:
return Op.Type.BROADCAST;
case... | [
"public",
"static",
"Op",
".",
"Type",
"getTypeFromByte",
"(",
"byte",
"type",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"OpType",
".",
"SCALAR",
":",
"return",
"Op",
".",
"Type",
".",
"SCALAR",
";",
"case",
"OpType",
".",
"SCALAR_BOOL",
":",
... | This method converts enums for Op.Type
@param type Byte representing the op type
@return Op type | [
"This",
"method",
"converts",
"enums",
"for",
"Op",
".",
"Type"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/serde/FlatBuffersMapper.java#L151-L198 |
128,305 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/serde/FlatBuffersMapper.java | FlatBuffersMapper.getFlatOpType | public static byte getFlatOpType(Op.Type type) {
switch (type) {
case SCALAR:
return OpType.SCALAR;
case SCALAR_BOOL:
return OpType.SCALAR_BOOL;
case BROADCAST:
return OpType.BROADCAST;
case BROADCAST_BOOL:
... | java | public static byte getFlatOpType(Op.Type type) {
switch (type) {
case SCALAR:
return OpType.SCALAR;
case SCALAR_BOOL:
return OpType.SCALAR_BOOL;
case BROADCAST:
return OpType.BROADCAST;
case BROADCAST_BOOL:
... | [
"public",
"static",
"byte",
"getFlatOpType",
"(",
"Op",
".",
"Type",
"type",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"SCALAR",
":",
"return",
"OpType",
".",
"SCALAR",
";",
"case",
"SCALAR_BOOL",
":",
"return",
"OpType",
".",
"SCALAR_BOOL",
";"... | This method converts an Op.Type to it's corresponding byte value
@param type type to convert
@return Byte representing the op type | [
"This",
"method",
"converts",
"an",
"Op",
".",
"Type",
"to",
"it",
"s",
"corresponding",
"byte",
"value"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/serde/FlatBuffersMapper.java#L206-L264 |
128,306 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/serde/FlatBuffersMapper.java | FlatBuffersMapper.getOrderFromByte | public static ByteOrder getOrderFromByte(byte val) {
if (val == org.nd4j.graph.ByteOrder.LE)
return ByteOrder.LITTLE_ENDIAN;
else
return ByteOrder.BIG_ENDIAN;
} | java | public static ByteOrder getOrderFromByte(byte val) {
if (val == org.nd4j.graph.ByteOrder.LE)
return ByteOrder.LITTLE_ENDIAN;
else
return ByteOrder.BIG_ENDIAN;
} | [
"public",
"static",
"ByteOrder",
"getOrderFromByte",
"(",
"byte",
"val",
")",
"{",
"if",
"(",
"val",
"==",
"org",
".",
"nd4j",
".",
"graph",
".",
"ByteOrder",
".",
"LE",
")",
"return",
"ByteOrder",
".",
"LITTLE_ENDIAN",
";",
"else",
"return",
"ByteOrder",
... | This method just converts enums
@param val
@return | [
"This",
"method",
"just",
"converts",
"enums"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/serde/FlatBuffersMapper.java#L273-L278 |
128,307 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/serde/FlatBuffersMapper.java | FlatBuffersMapper.getOrderAsByte | public static byte getOrderAsByte() {
if (ByteOrder.nativeOrder().equals(ByteOrder.BIG_ENDIAN))
return org.nd4j.graph.ByteOrder.BE;
else
return org.nd4j.graph.ByteOrder.LE;
} | java | public static byte getOrderAsByte() {
if (ByteOrder.nativeOrder().equals(ByteOrder.BIG_ENDIAN))
return org.nd4j.graph.ByteOrder.BE;
else
return org.nd4j.graph.ByteOrder.LE;
} | [
"public",
"static",
"byte",
"getOrderAsByte",
"(",
")",
"{",
"if",
"(",
"ByteOrder",
".",
"nativeOrder",
"(",
")",
".",
"equals",
"(",
"ByteOrder",
".",
"BIG_ENDIAN",
")",
")",
"return",
"org",
".",
"nd4j",
".",
"graph",
".",
"ByteOrder",
".",
"BE",
";... | This method returns current byte order for this JVM as libnd4j enum
@return | [
"This",
"method",
"returns",
"current",
"byte",
"order",
"for",
"this",
"JVM",
"as",
"libnd4j",
"enum"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/serde/FlatBuffersMapper.java#L285-L290 |
128,308 | deeplearning4j/deeplearning4j | nd4j/nd4j-serde/nd4j-aeron/src/main/java/org/nd4j/aeron/ipc/chunk/NDArrayMessageChunk.java | NDArrayMessageChunk.toBuffer | public static ByteBuffer toBuffer(NDArrayMessageChunk chunk) {
ByteBuffer ret = ByteBuffer.allocateDirect(sizeForMessage(chunk)).order(ByteOrder.nativeOrder());
//the messages opType enum as an int
ret.putInt(chunk.getMessageType().ordinal());
//the number of chunks this chunk is apart o... | java | public static ByteBuffer toBuffer(NDArrayMessageChunk chunk) {
ByteBuffer ret = ByteBuffer.allocateDirect(sizeForMessage(chunk)).order(ByteOrder.nativeOrder());
//the messages opType enum as an int
ret.putInt(chunk.getMessageType().ordinal());
//the number of chunks this chunk is apart o... | [
"public",
"static",
"ByteBuffer",
"toBuffer",
"(",
"NDArrayMessageChunk",
"chunk",
")",
"{",
"ByteBuffer",
"ret",
"=",
"ByteBuffer",
".",
"allocateDirect",
"(",
"sizeForMessage",
"(",
"chunk",
")",
")",
".",
"order",
"(",
"ByteOrder",
".",
"nativeOrder",
"(",
... | Convert an ndarray message chunk to a buffer.
@param chunk the chunk to convert
@return an {@link ByteBuffer} based on the
passed in message chunk. | [
"Convert",
"an",
"ndarray",
"message",
"chunk",
"to",
"a",
"buffer",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-serde/nd4j-aeron/src/main/java/org/nd4j/aeron/ipc/chunk/NDArrayMessageChunk.java#L94-L111 |
128,309 | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/util/ArchiveUtils.java | ArchiveUtils.tarGzListFiles | public static List<String> tarGzListFiles(File tarGzFile) throws IOException {
try(TarArchiveInputStream tin = new TarArchiveInputStream(new GZIPInputStream(new BufferedInputStream(new FileInputStream(tarGzFile))))) {
ArchiveEntry entry;
List<String> out = new ArrayList<>();
... | java | public static List<String> tarGzListFiles(File tarGzFile) throws IOException {
try(TarArchiveInputStream tin = new TarArchiveInputStream(new GZIPInputStream(new BufferedInputStream(new FileInputStream(tarGzFile))))) {
ArchiveEntry entry;
List<String> out = new ArrayList<>();
... | [
"public",
"static",
"List",
"<",
"String",
">",
"tarGzListFiles",
"(",
"File",
"tarGzFile",
")",
"throws",
"IOException",
"{",
"try",
"(",
"TarArchiveInputStream",
"tin",
"=",
"new",
"TarArchiveInputStream",
"(",
"new",
"GZIPInputStream",
"(",
"new",
"BufferedInpu... | List all of the files and directories in the specified tar.gz file
@param tarGzFile A tar.gz file
@return List of files and directories | [
"List",
"all",
"of",
"the",
"files",
"and",
"directories",
"in",
"the",
"specified",
"tar",
".",
"gz",
"file"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/util/ArchiveUtils.java#L164-L174 |
128,310 | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/util/ArchiveUtils.java | ArchiveUtils.zipListFiles | public static List<String> zipListFiles(File zipFile) throws IOException {
List<String> out = new ArrayList<>();
try (ZipFile zf = new ZipFile(zipFile)) {
Enumeration entries = zf.entries();
while (entries.hasMoreElements()) {
ZipEntry ze = (ZipEntry) entries.next... | java | public static List<String> zipListFiles(File zipFile) throws IOException {
List<String> out = new ArrayList<>();
try (ZipFile zf = new ZipFile(zipFile)) {
Enumeration entries = zf.entries();
while (entries.hasMoreElements()) {
ZipEntry ze = (ZipEntry) entries.next... | [
"public",
"static",
"List",
"<",
"String",
">",
"zipListFiles",
"(",
"File",
"zipFile",
")",
"throws",
"IOException",
"{",
"List",
"<",
"String",
">",
"out",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"try",
"(",
"ZipFile",
"zf",
"=",
"new",
"ZipFil... | List all of the files and directories in the specified .zip file
@param zipFile Zip file
@return List of files and directories | [
"List",
"all",
"of",
"the",
"files",
"and",
"directories",
"in",
"the",
"specified",
".",
"zip",
"file"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/util/ArchiveUtils.java#L182-L192 |
128,311 | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/util/ArchiveUtils.java | ArchiveUtils.zipExtractSingleFile | public static void zipExtractSingleFile(File zipFile, File destination, String pathInZip) throws IOException {
try (ZipFile zf = new ZipFile(zipFile); InputStream is = new BufferedInputStream(zf.getInputStream(zf.getEntry(pathInZip)));
OutputStream os = new BufferedOutputStream(new FileOutputStream... | java | public static void zipExtractSingleFile(File zipFile, File destination, String pathInZip) throws IOException {
try (ZipFile zf = new ZipFile(zipFile); InputStream is = new BufferedInputStream(zf.getInputStream(zf.getEntry(pathInZip)));
OutputStream os = new BufferedOutputStream(new FileOutputStream... | [
"public",
"static",
"void",
"zipExtractSingleFile",
"(",
"File",
"zipFile",
",",
"File",
"destination",
",",
"String",
"pathInZip",
")",
"throws",
"IOException",
"{",
"try",
"(",
"ZipFile",
"zf",
"=",
"new",
"ZipFile",
"(",
"zipFile",
")",
";",
"InputStream",
... | Extract a single file from a .zip file. Does not support directories
@param zipFile Zip file to extract from
@param destination Destination file
@param pathInZip Path in the zip to extract
@throws IOException If exception occurs while reading/writing | [
"Extract",
"a",
"single",
"file",
"from",
"a",
".",
"zip",
"file",
".",
"Does",
"not",
"support",
"directories"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/util/ArchiveUtils.java#L202-L207 |
128,312 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/validation/OpValidation.java | OpValidation.validate | public static String validate(OpTestCase testCase) {
collectCoverageInformation(testCase);
//Check shape function:
List<LongShapeDescriptor> outShapes;
try {
outShapes = Nd4j.getExecutioner().calculateOutputShape(testCase.op());
} catch (Throwable t) {
th... | java | public static String validate(OpTestCase testCase) {
collectCoverageInformation(testCase);
//Check shape function:
List<LongShapeDescriptor> outShapes;
try {
outShapes = Nd4j.getExecutioner().calculateOutputShape(testCase.op());
} catch (Throwable t) {
th... | [
"public",
"static",
"String",
"validate",
"(",
"OpTestCase",
"testCase",
")",
"{",
"collectCoverageInformation",
"(",
"testCase",
")",
";",
"//Check shape function:",
"List",
"<",
"LongShapeDescriptor",
">",
"outShapes",
";",
"try",
"{",
"outShapes",
"=",
"Nd4j",
... | Validate the outputs of a single op
@param testCase Op test case to run
@return NULL if test is OK, or an error message otherwise | [
"Validate",
"the",
"outputs",
"of",
"a",
"single",
"op"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/validation/OpValidation.java#L353-L401 |
128,313 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/validation/OpValidation.java | OpValidation.excludeFromTfImportCoverage | private static Set<String> excludeFromTfImportCoverage(){
List<String> list = Arrays.asList(
"Reverse", //Can be excluded because "Reverse_v2" is synonym that TF uses with tf.reverse(...); ReverseV2 is also Java op that is synonym for same op
"LogSigmoid", //Not in ops.pr... | java | private static Set<String> excludeFromTfImportCoverage(){
List<String> list = Arrays.asList(
"Reverse", //Can be excluded because "Reverse_v2" is synonym that TF uses with tf.reverse(...); ReverseV2 is also Java op that is synonym for same op
"LogSigmoid", //Not in ops.pr... | [
"private",
"static",
"Set",
"<",
"String",
">",
"excludeFromTfImportCoverage",
"(",
")",
"{",
"List",
"<",
"String",
">",
"list",
"=",
"Arrays",
".",
"asList",
"(",
"\"Reverse\"",
",",
"//Can be excluded because \"Reverse_v2\" is synonym that TF uses with tf.reverse(...);... | These ops are excluded from TF import test coverage, for various reasons | [
"These",
"ops",
"are",
"excluded",
"from",
"TF",
"import",
"test",
"coverage",
"for",
"various",
"reasons"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/validation/OpValidation.java#L939-L980 |
128,314 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/util/ComputationGraphUtil.java | ComputationGraphUtil.toMultiDataSet | public static MultiDataSet toMultiDataSet(DataSet dataSet) {
INDArray f = dataSet.getFeatures();
INDArray l = dataSet.getLabels();
INDArray fMask = dataSet.getFeaturesMaskArray();
INDArray lMask = dataSet.getLabelsMaskArray();
INDArray[] fNew = f == null ? null : new INDArray[] ... | java | public static MultiDataSet toMultiDataSet(DataSet dataSet) {
INDArray f = dataSet.getFeatures();
INDArray l = dataSet.getLabels();
INDArray fMask = dataSet.getFeaturesMaskArray();
INDArray lMask = dataSet.getLabelsMaskArray();
INDArray[] fNew = f == null ? null : new INDArray[] ... | [
"public",
"static",
"MultiDataSet",
"toMultiDataSet",
"(",
"DataSet",
"dataSet",
")",
"{",
"INDArray",
"f",
"=",
"dataSet",
".",
"getFeatures",
"(",
")",
";",
"INDArray",
"l",
"=",
"dataSet",
".",
"getLabels",
"(",
")",
";",
"INDArray",
"fMask",
"=",
"data... | Convert a DataSet to the equivalent MultiDataSet | [
"Convert",
"a",
"DataSet",
"to",
"the",
"equivalent",
"MultiDataSet"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/util/ComputationGraphUtil.java#L31-L43 |
128,315 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasInitilizationUtils.java | KerasInitilizationUtils.getWeightInitFromConfig | public static Pair<WeightInit, Distribution> getWeightInitFromConfig(Map<String, Object> layerConfig, String initField,
boolean enforceTrainingConfig,
KerasLayerConfiguration... | java | public static Pair<WeightInit, Distribution> getWeightInitFromConfig(Map<String, Object> layerConfig, String initField,
boolean enforceTrainingConfig,
KerasLayerConfiguration... | [
"public",
"static",
"Pair",
"<",
"WeightInit",
",",
"Distribution",
">",
"getWeightInitFromConfig",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
",",
"String",
"initField",
",",
"boolean",
"enforceTrainingConfig",
",",
"KerasLayerConfiguration",
"co... | Get weight initialization from Keras layer configuration.
@param layerConfig dictionary containing Keras layer configuration
@param enforceTrainingConfig whether to enforce loading configuration for further training
@return Pair of DL4J weight initialization and distribution
@throws InvalidKerasConfiguration... | [
"Get",
"weight",
"initialization",
"from",
"Keras",
"layer",
"configuration",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/utils/KerasInitilizationUtils.java#L205-L240 |
128,316 | deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/transport/BaseTransport.java | BaseTransport.shardMessageHandler | protected void shardMessageHandler(DirectBuffer buffer, int offset, int length, Header header) {
/**
* All incoming messages here are supposed to be unicast messages.
*/
// TODO: implement fragmentation handler here PROBABLY. Or forbid messages > MTU?
//log.info("shardMessageHa... | java | protected void shardMessageHandler(DirectBuffer buffer, int offset, int length, Header header) {
/**
* All incoming messages here are supposed to be unicast messages.
*/
// TODO: implement fragmentation handler here PROBABLY. Or forbid messages > MTU?
//log.info("shardMessageHa... | [
"protected",
"void",
"shardMessageHandler",
"(",
"DirectBuffer",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
",",
"Header",
"header",
")",
"{",
"/**\n * All incoming messages here are supposed to be unicast messages.\n */",
"// TODO: implement fragmentat... | This message handler is responsible for receiving messages on Shard side
@param buffer
@param offset
@param length
@param header | [
"This",
"message",
"handler",
"is",
"responsible",
"for",
"receiving",
"messages",
"on",
"Shard",
"side"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/transport/BaseTransport.java#L220-L238 |
128,317 | deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/transport/BaseTransport.java | BaseTransport.internalMessageHandler | protected void internalMessageHandler(DirectBuffer buffer, int offset, int length, Header header) {
/**
* All incoming internal messages are either op commands, or aggregation messages that are tied to commands
*/
byte[] data = new byte[length];
buffer.getBytes(offset, data);
... | java | protected void internalMessageHandler(DirectBuffer buffer, int offset, int length, Header header) {
/**
* All incoming internal messages are either op commands, or aggregation messages that are tied to commands
*/
byte[] data = new byte[length];
buffer.getBytes(offset, data);
... | [
"protected",
"void",
"internalMessageHandler",
"(",
"DirectBuffer",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
",",
"Header",
"header",
")",
"{",
"/**\n * All incoming internal messages are either op commands, or aggregation messages that are tied to commands\n ... | This message handler is responsible for receiving coordination messages on Shard side
@param buffer
@param offset
@param length
@param header | [
"This",
"message",
"handler",
"is",
"responsible",
"for",
"receiving",
"coordination",
"messages",
"on",
"Shard",
"side"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/transport/BaseTransport.java#L248-L260 |
128,318 | deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/transport/BaseTransport.java | BaseTransport.clientMessageHandler | protected void clientMessageHandler(DirectBuffer buffer, int offset, int length, Header header) {
/**
* All incoming messages here are supposed to be "just messages", only unicast communication
* All of them should implement MeaningfulMessage interface
*/
// TODO: to be impl... | java | protected void clientMessageHandler(DirectBuffer buffer, int offset, int length, Header header) {
/**
* All incoming messages here are supposed to be "just messages", only unicast communication
* All of them should implement MeaningfulMessage interface
*/
// TODO: to be impl... | [
"protected",
"void",
"clientMessageHandler",
"(",
"DirectBuffer",
"buffer",
",",
"int",
"offset",
",",
"int",
"length",
",",
"Header",
"header",
")",
"{",
"/**\n * All incoming messages here are supposed to be \"just messages\", only unicast communication\n * All ... | This message handler is responsible for receiving messages on Client side
@param buffer
@param offset
@param length
@param header | [
"This",
"message",
"handler",
"is",
"responsible",
"for",
"receiving",
"messages",
"on",
"Client",
"side"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/transport/BaseTransport.java#L269-L282 |
128,319 | deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/transport/BaseTransport.java | BaseTransport.init | @Override
public void init(VoidConfiguration voidConfiguration, Clipboard clipboard, NodeRole role, String localIp,
int localPort, short shardIndex) {
//Runtime.getRuntime().addShutdownHook(new Thread(() -> shutdownSilent()));
} | java | @Override
public void init(VoidConfiguration voidConfiguration, Clipboard clipboard, NodeRole role, String localIp,
int localPort, short shardIndex) {
//Runtime.getRuntime().addShutdownHook(new Thread(() -> shutdownSilent()));
} | [
"@",
"Override",
"public",
"void",
"init",
"(",
"VoidConfiguration",
"voidConfiguration",
",",
"Clipboard",
"clipboard",
",",
"NodeRole",
"role",
",",
"String",
"localIp",
",",
"int",
"localPort",
",",
"short",
"shardIndex",
")",
"{",
"//Runtime.getRuntime().addShut... | This method does initialization of Transport instance
@param voidConfiguration
@param clipboard
@param role
@param localIp
@param localPort
@param shardIndex | [
"This",
"method",
"does",
"initialization",
"of",
"Transport",
"instance"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/transport/BaseTransport.java#L310-L314 |
128,320 | deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/transport/BaseTransport.java | BaseTransport.shutdown | @Override
public void shutdown() {
// Since Aeron's poll isn't blocking, all we need is just special flag
runner.set(false);
try {
threadA.join();
if (threadB != null)
threadB.join();
} catch (Exception e) {
//
}
Cl... | java | @Override
public void shutdown() {
// Since Aeron's poll isn't blocking, all we need is just special flag
runner.set(false);
try {
threadA.join();
if (threadB != null)
threadB.join();
} catch (Exception e) {
//
}
Cl... | [
"@",
"Override",
"public",
"void",
"shutdown",
"(",
")",
"{",
"// Since Aeron's poll isn't blocking, all we need is just special flag",
"runner",
".",
"set",
"(",
"false",
")",
";",
"try",
"{",
"threadA",
".",
"join",
"(",
")",
";",
"if",
"(",
"threadB",
"!=",
... | This method stops transport system. | [
"This",
"method",
"stops",
"transport",
"system",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/transport/BaseTransport.java#L430-L448 |
128,321 | deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/transport/BaseTransport.java | BaseTransport.receiveMessage | @Override
public void receiveMessage(VoidMessage message) {
try {
log.info("Message received, saving...");
messages.put(message);
} catch (Exception e) {
// do nothing
}
} | java | @Override
public void receiveMessage(VoidMessage message) {
try {
log.info("Message received, saving...");
messages.put(message);
} catch (Exception e) {
// do nothing
}
} | [
"@",
"Override",
"public",
"void",
"receiveMessage",
"(",
"VoidMessage",
"message",
")",
"{",
"try",
"{",
"log",
".",
"info",
"(",
"\"Message received, saving...\"",
")",
";",
"messages",
".",
"put",
"(",
"message",
")",
";",
"}",
"catch",
"(",
"Exception",
... | This method saves incoming message to the Queue, for later dispatch from higher-level code, like actual TrainingFunction or VoidParameterServer itself
@param message | [
"This",
"method",
"saves",
"incoming",
"message",
"to",
"the",
"Queue",
"for",
"later",
"dispatch",
"from",
"higher",
"-",
"level",
"code",
"like",
"actual",
"TrainingFunction",
"or",
"VoidParameterServer",
"itself"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/transport/BaseTransport.java#L455-L463 |
128,322 | deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/transport/BaseTransport.java | BaseTransport.takeMessage | @Override
public VoidMessage takeMessage() {
if (threadingModel != ThreadingModel.SAME_THREAD) {
try {
return messages.take();
} catch (InterruptedException e) {
// probably we don't want to do anything here
return null;
} c... | java | @Override
public VoidMessage takeMessage() {
if (threadingModel != ThreadingModel.SAME_THREAD) {
try {
return messages.take();
} catch (InterruptedException e) {
// probably we don't want to do anything here
return null;
} c... | [
"@",
"Override",
"public",
"VoidMessage",
"takeMessage",
"(",
")",
"{",
"if",
"(",
"threadingModel",
"!=",
"ThreadingModel",
".",
"SAME_THREAD",
")",
"{",
"try",
"{",
"return",
"messages",
".",
"take",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException"... | This method takes 1 message from "incoming messages" queue, blocking if queue is empty
@return | [
"This",
"method",
"takes",
"1",
"message",
"from",
"incoming",
"messages",
"queue",
"blocking",
"if",
"queue",
"is",
"empty"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/transport/BaseTransport.java#L470-L493 |
128,323 | deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/transport/BaseTransport.java | BaseTransport.sendCommandToShard | protected synchronized void sendCommandToShard(VoidMessage message) {
// if this node is shard - we just step over TCP/IP infrastructure
// TODO: we want LocalTransport to be used in such cases
if (nodeRole == NodeRole.SHARD) {
message.setTargetId(shardIndex);
messages.ad... | java | protected synchronized void sendCommandToShard(VoidMessage message) {
// if this node is shard - we just step over TCP/IP infrastructure
// TODO: we want LocalTransport to be used in such cases
if (nodeRole == NodeRole.SHARD) {
message.setTargetId(shardIndex);
messages.ad... | [
"protected",
"synchronized",
"void",
"sendCommandToShard",
"(",
"VoidMessage",
"message",
")",
"{",
"// if this node is shard - we just step over TCP/IP infrastructure",
"// TODO: we want LocalTransport to be used in such cases",
"if",
"(",
"nodeRole",
"==",
"NodeRole",
".",
"SHARD... | This command is possible to issue only from Client
@param message | [
"This",
"command",
"is",
"possible",
"to",
"issue",
"only",
"from",
"Client"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-node/src/main/java/org/nd4j/parameterserver/distributed/transport/BaseTransport.java#L522-L553 |
128,324 | deeplearning4j/deeplearning4j | nd4j/nd4j-buffer/src/main/java/org/nd4j/linalg/api/buffer/BaseDataBuffer.java | BaseDataBuffer.getTrackingPoint | @Override
public Long getTrackingPoint() {
if (underlyingDataBuffer() != this)
return underlyingDataBuffer() == null ? trackingPoint : underlyingDataBuffer().getTrackingPoint();
return trackingPoint;
} | java | @Override
public Long getTrackingPoint() {
if (underlyingDataBuffer() != this)
return underlyingDataBuffer() == null ? trackingPoint : underlyingDataBuffer().getTrackingPoint();
return trackingPoint;
} | [
"@",
"Override",
"public",
"Long",
"getTrackingPoint",
"(",
")",
"{",
"if",
"(",
"underlyingDataBuffer",
"(",
")",
"!=",
"this",
")",
"return",
"underlyingDataBuffer",
"(",
")",
"==",
"null",
"?",
"trackingPoint",
":",
"underlyingDataBuffer",
"(",
")",
".",
... | Returns tracking point for Allocator
PLEASE NOTE: Suitable & meaningful only for specific backends
@return | [
"Returns",
"tracking",
"point",
"for",
"Allocator"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-buffer/src/main/java/org/nd4j/linalg/api/buffer/BaseDataBuffer.java#L2128-L2133 |
128,325 | deeplearning4j/deeplearning4j | rl4j/rl4j-core/src/main/java/org/deeplearning4j/rl4j/learning/sync/qlearning/discrete/QLearningDiscrete.java | QLearningDiscrete.trainStep | protected QLStepReturn<O> trainStep(O obs) {
Integer action;
INDArray input = getInput(obs);
boolean isHistoryProcessor = getHistoryProcessor() != null;
if (isHistoryProcessor)
getHistoryProcessor().record(input);
int skipFrame = isHistoryProcessor ? getHistoryPro... | java | protected QLStepReturn<O> trainStep(O obs) {
Integer action;
INDArray input = getInput(obs);
boolean isHistoryProcessor = getHistoryProcessor() != null;
if (isHistoryProcessor)
getHistoryProcessor().record(input);
int skipFrame = isHistoryProcessor ? getHistoryPro... | [
"protected",
"QLStepReturn",
"<",
"O",
">",
"trainStep",
"(",
"O",
"obs",
")",
"{",
"Integer",
"action",
";",
"INDArray",
"input",
"=",
"getInput",
"(",
"obs",
")",
";",
"boolean",
"isHistoryProcessor",
"=",
"getHistoryProcessor",
"(",
")",
"!=",
"null",
"... | Single step of training
@param obs last obs
@return relevant info for next step | [
"Single",
"step",
"of",
"training"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/rl4j/rl4j-core/src/main/java/org/deeplearning4j/rl4j/learning/sync/qlearning/discrete/QLearningDiscrete.java#L115-L190 |
128,326 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/text/tokenization/tokenizer/BertWordPieceStreamTokenizer.java | BertWordPieceStreamTokenizer.nextToken | @Override
public String nextToken() {
if (!tokens.isEmpty() && position.get() < tokens.size())
return tokens.get(position.getAndIncrement());
return nextTokenFromStream();
} | java | @Override
public String nextToken() {
if (!tokens.isEmpty() && position.get() < tokens.size())
return tokens.get(position.getAndIncrement());
return nextTokenFromStream();
} | [
"@",
"Override",
"public",
"String",
"nextToken",
"(",
")",
"{",
"if",
"(",
"!",
"tokens",
".",
"isEmpty",
"(",
")",
"&&",
"position",
".",
"get",
"(",
")",
"<",
"tokens",
".",
"size",
"(",
")",
")",
"return",
"tokens",
".",
"get",
"(",
"position",... | This method returns next token from prebuffered list of tokens or underlying InputStream
@return next token as String | [
"This",
"method",
"returns",
"next",
"token",
"from",
"prebuffered",
"list",
"of",
"tokens",
"or",
"underlying",
"InputStream"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/text/tokenization/tokenizer/BertWordPieceStreamTokenizer.java#L118-L124 |
128,327 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-data/deeplearning4j-datavec-iterators/src/main/java/org/deeplearning4j/datasets/datavec/RecordReaderMultiDataSetIterator.java | RecordReaderMultiDataSetIterator.filterRequiredColumns | private List<List<Writable>> filterRequiredColumns(String readerName, List<List<Writable>> list){
//Options: (a) entire reader
//(b) one or more subsets
boolean entireReader = false;
List<SubsetDetails> subsetList = null;
int max = -1;
int min = Integer.MAX_VALUE;
... | java | private List<List<Writable>> filterRequiredColumns(String readerName, List<List<Writable>> list){
//Options: (a) entire reader
//(b) one or more subsets
boolean entireReader = false;
List<SubsetDetails> subsetList = null;
int max = -1;
int min = Integer.MAX_VALUE;
... | [
"private",
"List",
"<",
"List",
"<",
"Writable",
">",
">",
"filterRequiredColumns",
"(",
"String",
"readerName",
",",
"List",
"<",
"List",
"<",
"Writable",
">",
">",
"list",
")",
"{",
"//Options: (a) entire reader",
"//(b) one or more subsets",
"boolean",
"entireR... | Filter out the required columns before conversion. This is to avoid trying to convert String etc columns | [
"Filter",
"out",
"the",
"required",
"columns",
"before",
"conversion",
".",
"This",
"is",
"to",
"avoid",
"trying",
"to",
"convert",
"String",
"etc",
"columns"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-data/deeplearning4j-datavec-iterators/src/main/java/org/deeplearning4j/datasets/datavec/RecordReaderMultiDataSetIterator.java#L217-L273 |
128,328 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-data/deeplearning4j-utility-iterators/src/main/java/org/deeplearning4j/datasets/iterator/CombinedPreProcessor.java | CombinedPreProcessor.preProcess | @Override
public void preProcess(DataSet toPreProcess) {
for (DataSetPreProcessor preProcessor : preProcessors) {
preProcessor.preProcess(toPreProcess);
}
} | java | @Override
public void preProcess(DataSet toPreProcess) {
for (DataSetPreProcessor preProcessor : preProcessors) {
preProcessor.preProcess(toPreProcess);
}
} | [
"@",
"Override",
"public",
"void",
"preProcess",
"(",
"DataSet",
"toPreProcess",
")",
"{",
"for",
"(",
"DataSetPreProcessor",
"preProcessor",
":",
"preProcessors",
")",
"{",
"preProcessor",
".",
"preProcess",
"(",
"toPreProcess",
")",
";",
"}",
"}"
] | Pre process a dataset sequentially
@param toPreProcess the data set to pre process | [
"Pre",
"process",
"a",
"dataset",
"sequentially"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-data/deeplearning4j-utility-iterators/src/main/java/org/deeplearning4j/datasets/iterator/CombinedPreProcessor.java#L43-L48 |
128,329 | deeplearning4j/deeplearning4j | arbiter/arbiter-ui/src/main/java/org/deeplearning4j/arbiter/ui/module/ArbiterModule.java | ArbiterModule.getModelLastUpdateTimes | private Result getModelLastUpdateTimes(String modelIDs){
if(currentSessionID == null){
return ok();
}
StatsStorage ss = knownSessionIDs.get(currentSessionID);
if(ss == null){
log.debug("getModelLastUpdateTimes(): Session ID is unknown: {}", currentSessionID);
... | java | private Result getModelLastUpdateTimes(String modelIDs){
if(currentSessionID == null){
return ok();
}
StatsStorage ss = knownSessionIDs.get(currentSessionID);
if(ss == null){
log.debug("getModelLastUpdateTimes(): Session ID is unknown: {}", currentSessionID);
... | [
"private",
"Result",
"getModelLastUpdateTimes",
"(",
"String",
"modelIDs",
")",
"{",
"if",
"(",
"currentSessionID",
"==",
"null",
")",
"{",
"return",
"ok",
"(",
")",
";",
"}",
"StatsStorage",
"ss",
"=",
"knownSessionIDs",
".",
"get",
"(",
"currentSessionID",
... | Get the last update time for the specified model IDs
@param modelIDs Model IDs to get the update time for | [
"Get",
"the",
"last",
"update",
"time",
"for",
"the",
"specified",
"model",
"IDs"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/arbiter/arbiter-ui/src/main/java/org/deeplearning4j/arbiter/ui/module/ArbiterModule.java#L272-L296 |
128,330 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/Convolution3DUtils.java | Convolution3DUtils.get3DSameModeTopLeftPadding | public static int[] get3DSameModeTopLeftPadding(int[] outSize, int[] inSize, int[] kernel, int[] strides,
int[] dilation) {
int[] eKernel = effectiveKernelSize(kernel, dilation);
int[] outPad = new int[3];
outPad[0] = ((outSize[0] - 1) * stride... | java | public static int[] get3DSameModeTopLeftPadding(int[] outSize, int[] inSize, int[] kernel, int[] strides,
int[] dilation) {
int[] eKernel = effectiveKernelSize(kernel, dilation);
int[] outPad = new int[3];
outPad[0] = ((outSize[0] - 1) * stride... | [
"public",
"static",
"int",
"[",
"]",
"get3DSameModeTopLeftPadding",
"(",
"int",
"[",
"]",
"outSize",
",",
"int",
"[",
"]",
"inSize",
",",
"int",
"[",
"]",
"kernel",
",",
"int",
"[",
"]",
"strides",
",",
"int",
"[",
"]",
"dilation",
")",
"{",
"int",
... | Get top and left padding for same mode only for 3d convolutions
@param outSize
@param inSize
@param kernel
@param strides
@return | [
"Get",
"top",
"and",
"left",
"padding",
"for",
"same",
"mode",
"only",
"for",
"3d",
"convolutions"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/Convolution3DUtils.java#L171-L179 |
128,331 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/allocator/tad/DeviceTADManager.java | DeviceTADManager.purgeBuffers | @Override
public void purgeBuffers() {
log.info("Purging TAD buffers...");
tadCache = new ArrayList<>();
int numDevices = Nd4j.getAffinityManager().getNumberOfDevices();
for (int i = 0; i < numDevices; i++) {
log.info("Resetting device: [{}]", i);
tadCache.... | java | @Override
public void purgeBuffers() {
log.info("Purging TAD buffers...");
tadCache = new ArrayList<>();
int numDevices = Nd4j.getAffinityManager().getNumberOfDevices();
for (int i = 0; i < numDevices; i++) {
log.info("Resetting device: [{}]", i);
tadCache.... | [
"@",
"Override",
"public",
"void",
"purgeBuffers",
"(",
")",
"{",
"log",
".",
"info",
"(",
"\"Purging TAD buffers...\"",
")",
";",
"tadCache",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"int",
"numDevices",
"=",
"Nd4j",
".",
"getAffinityManager",
"(",
"... | This method removes all cached shape buffers | [
"This",
"method",
"removes",
"all",
"cached",
"shape",
"buffers"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/allocator/tad/DeviceTADManager.java#L55-L69 |
128,332 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/wordvectors/WordVectorsImpl.java | WordVectorsImpl.getLayerSize | public int getLayerSize() {
if (lookupTable != null && lookupTable.getWeights() != null) {
return lookupTable.getWeights().columns();
} else
return layerSize;
} | java | public int getLayerSize() {
if (lookupTable != null && lookupTable.getWeights() != null) {
return lookupTable.getWeights().columns();
} else
return layerSize;
} | [
"public",
"int",
"getLayerSize",
"(",
")",
"{",
"if",
"(",
"lookupTable",
"!=",
"null",
"&&",
"lookupTable",
".",
"getWeights",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"lookupTable",
".",
"getWeights",
"(",
")",
".",
"columns",
"(",
")",
";",
"}",
... | This method returns word vector size
@return | [
"This",
"method",
"returns",
"word",
"vector",
"size"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/wordvectors/WordVectorsImpl.java#L86-L91 |
128,333 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/wordvectors/WordVectorsImpl.java | WordVectorsImpl.getWordVectorMatrixNormalized | public INDArray getWordVectorMatrixNormalized(String word) {
INDArray r = getWordVectorMatrix(word);
if (r == null)
return null;
return r.div(Nd4j.getBlasWrapper().nrm2(r));
} | java | public INDArray getWordVectorMatrixNormalized(String word) {
INDArray r = getWordVectorMatrix(word);
if (r == null)
return null;
return r.div(Nd4j.getBlasWrapper().nrm2(r));
} | [
"public",
"INDArray",
"getWordVectorMatrixNormalized",
"(",
"String",
"word",
")",
"{",
"INDArray",
"r",
"=",
"getWordVectorMatrix",
"(",
"word",
")",
";",
"if",
"(",
"r",
"==",
"null",
")",
"return",
"null",
";",
"return",
"r",
".",
"div",
"(",
"Nd4j",
... | Returns the word vector divided by the norm2 of the array
@param word the word to get the matrix for
@return the looked up matrix | [
"Returns",
"the",
"word",
"vector",
"divided",
"by",
"the",
"norm2",
"of",
"the",
"array"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/wordvectors/WordVectorsImpl.java#L197-L203 |
128,334 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/callbacks/ModelSavingCallback.java | ModelSavingCallback.save | protected void save(Model model, String filename) {
try {
ModelSerializer.writeModel(model, filename, true);
} catch (IOException e) {
throw new RuntimeException(e);
}
} | java | protected void save(Model model, String filename) {
try {
ModelSerializer.writeModel(model, filename, true);
} catch (IOException e) {
throw new RuntimeException(e);
}
} | [
"protected",
"void",
"save",
"(",
"Model",
"model",
",",
"String",
"filename",
")",
"{",
"try",
"{",
"ModelSerializer",
".",
"writeModel",
"(",
"model",
",",
"filename",
",",
"true",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"... | This method saves model
@param model
@param filename | [
"This",
"method",
"saves",
"model"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/listeners/callbacks/ModelSavingCallback.java#L89-L95 |
128,335 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/quadtree/QuadTree.java | QuadTree.findIndex | protected QuadTree findIndex(INDArray coordinates) {
// Compute the sector for the coordinates
boolean left = (coordinates.getDouble(0) <= (boundary.getX() + boundary.getHw() / 2));
boolean top = (coordinates.getDouble(1) <= (boundary.getY() + boundary.getHh() / 2));
// top left
... | java | protected QuadTree findIndex(INDArray coordinates) {
// Compute the sector for the coordinates
boolean left = (coordinates.getDouble(0) <= (boundary.getX() + boundary.getHw() / 2));
boolean top = (coordinates.getDouble(1) <= (boundary.getY() + boundary.getHh() / 2));
// top left
... | [
"protected",
"QuadTree",
"findIndex",
"(",
"INDArray",
"coordinates",
")",
"{",
"// Compute the sector for the coordinates",
"boolean",
"left",
"=",
"(",
"coordinates",
".",
"getDouble",
"(",
"0",
")",
"<=",
"(",
"boundary",
".",
"getX",
"(",
")",
"+",
"boundary... | Returns the cell of this element
@param coordinates
@return | [
"Returns",
"the",
"cell",
"of",
"this",
"element"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/quadtree/QuadTree.java#L95-L122 |
128,336 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/quadtree/QuadTree.java | QuadTree.insert | public boolean insert(int newIndex) {
// Ignore objects which do not belong in this quad tree
INDArray point = data.slice(newIndex);
if (!boundary.containsPoint(point))
return false;
cumSize++;
double mult1 = (double) (cumSize - 1) / (double) cumSize;
double ... | java | public boolean insert(int newIndex) {
// Ignore objects which do not belong in this quad tree
INDArray point = data.slice(newIndex);
if (!boundary.containsPoint(point))
return false;
cumSize++;
double mult1 = (double) (cumSize - 1) / (double) cumSize;
double ... | [
"public",
"boolean",
"insert",
"(",
"int",
"newIndex",
")",
"{",
"// Ignore objects which do not belong in this quad tree",
"INDArray",
"point",
"=",
"data",
".",
"slice",
"(",
"newIndex",
")",
";",
"if",
"(",
"!",
"boundary",
".",
"containsPoint",
"(",
"point",
... | Insert an index of the data in to the tree
@param newIndex the index to insert in to the tree
@return whether the index was inserted or not | [
"Insert",
"an",
"index",
"of",
"the",
"data",
"in",
"to",
"the",
"tree"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/quadtree/QuadTree.java#L130-L177 |
128,337 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/quadtree/QuadTree.java | QuadTree.isCorrect | public boolean isCorrect() {
for (int n = 0; n < size; n++) {
INDArray point = data.slice(index[n]);
if (!boundary.containsPoint(point))
return false;
}
return isLeaf() || northWest.isCorrect() && northEast.isCorrect() && southWest.isCorrect()
... | java | public boolean isCorrect() {
for (int n = 0; n < size; n++) {
INDArray point = data.slice(index[n]);
if (!boundary.containsPoint(point))
return false;
}
return isLeaf() || northWest.isCorrect() && northEast.isCorrect() && southWest.isCorrect()
... | [
"public",
"boolean",
"isCorrect",
"(",
")",
"{",
"for",
"(",
"int",
"n",
"=",
"0",
";",
"n",
"<",
"size",
";",
"n",
"++",
")",
"{",
"INDArray",
"point",
"=",
"data",
".",
"slice",
"(",
"index",
"[",
"n",
"]",
")",
";",
"if",
"(",
"!",
"bounda... | Returns whether the tree is consistent or not
@return whether the tree is consistent or not | [
"Returns",
"whether",
"the",
"tree",
"is",
"consistent",
"or",
"not"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/quadtree/QuadTree.java#L196-L207 |
128,338 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/quadtree/QuadTree.java | QuadTree.subDivide | public void subDivide() {
northWest = new QuadTree(this, data, new Cell(boundary.getX() - .5 * boundary.getHw(),
boundary.getY() - .5 * boundary.getHh(), .5 * boundary.getHw(), .5 * boundary.getHh()));
northEast = new QuadTree(this, data, new Cell(boundary.getX() + .5 * boundary.... | java | public void subDivide() {
northWest = new QuadTree(this, data, new Cell(boundary.getX() - .5 * boundary.getHw(),
boundary.getY() - .5 * boundary.getHh(), .5 * boundary.getHw(), .5 * boundary.getHh()));
northEast = new QuadTree(this, data, new Cell(boundary.getX() + .5 * boundary.... | [
"public",
"void",
"subDivide",
"(",
")",
"{",
"northWest",
"=",
"new",
"QuadTree",
"(",
"this",
",",
"data",
",",
"new",
"Cell",
"(",
"boundary",
".",
"getX",
"(",
")",
"-",
".5",
"*",
"boundary",
".",
"getHw",
"(",
")",
",",
"boundary",
".",
"getY... | Create four children
which fully divide this cell
into four quads of equal area | [
"Create",
"four",
"children",
"which",
"fully",
"divide",
"this",
"cell",
"into",
"four",
"quads",
"of",
"equal",
"area"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/quadtree/QuadTree.java#L216-L226 |
128,339 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/quadtree/QuadTree.java | QuadTree.depth | public int depth() {
if (isLeaf())
return 1;
return 1 + max(max(northWest.depth(), northEast.depth()), max(southWest.depth(), southEast.depth()));
} | java | public int depth() {
if (isLeaf())
return 1;
return 1 + max(max(northWest.depth(), northEast.depth()), max(southWest.depth(), southEast.depth()));
} | [
"public",
"int",
"depth",
"(",
")",
"{",
"if",
"(",
"isLeaf",
"(",
")",
")",
"return",
"1",
";",
"return",
"1",
"+",
"max",
"(",
"max",
"(",
"northWest",
".",
"depth",
"(",
")",
",",
"northEast",
".",
"depth",
"(",
")",
")",
",",
"max",
"(",
... | The depth of the node
@return the depth of the node | [
"The",
"depth",
"of",
"the",
"node"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/quadtree/QuadTree.java#L304-L308 |
128,340 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.getMaxShape | public static long[] getMaxShape(INDArray...inputs) {
if(inputs == null)
return null;
else if(inputs.length < 2)
return inputs[0].shape();
else {
long[] currMax = inputs[0].shape();
for(int i = 1; i < inputs.length; i++) {
if(input... | java | public static long[] getMaxShape(INDArray...inputs) {
if(inputs == null)
return null;
else if(inputs.length < 2)
return inputs[0].shape();
else {
long[] currMax = inputs[0].shape();
for(int i = 1; i < inputs.length; i++) {
if(input... | [
"public",
"static",
"long",
"[",
"]",
"getMaxShape",
"(",
"INDArray",
"...",
"inputs",
")",
"{",
"if",
"(",
"inputs",
"==",
"null",
")",
"return",
"null",
";",
"else",
"if",
"(",
"inputs",
".",
"length",
"<",
"2",
")",
"return",
"inputs",
"[",
"0",
... | Return the shape of the largest length array
based on the input
@param inputs the inputs to get the max shape for
@return the largest shape based on the inputs | [
"Return",
"the",
"shape",
"of",
"the",
"largest",
"length",
"array",
"based",
"on",
"the",
"input"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L59-L77 |
128,341 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.isPlaceholderShape | public static boolean isPlaceholderShape(int[] shape) {
if(shape == null)
return true;
else {
for(int i = 0; i < shape.length; i++) {
if(shape[i] < 0)
return true;
}
}
return false;
} | java | public static boolean isPlaceholderShape(int[] shape) {
if(shape == null)
return true;
else {
for(int i = 0; i < shape.length; i++) {
if(shape[i] < 0)
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"isPlaceholderShape",
"(",
"int",
"[",
"]",
"shape",
")",
"{",
"if",
"(",
"shape",
"==",
"null",
")",
"return",
"true",
";",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"shape",
".",
"length",
";",
... | Returns true if any shape has a -1
or a null or empty array is passed in
@param shape the input shape to validate
@return true if the shape is null,empty, or contains a -1 element | [
"Returns",
"true",
"if",
"any",
"shape",
"has",
"a",
"-",
"1",
"or",
"a",
"null",
"or",
"empty",
"array",
"is",
"passed",
"in"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L98-L109 |
128,342 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.getReducedShape | public static long[] getReducedShape(int[] wholeShape, int[] dimensions) {
if (isWholeArray(wholeShape, dimensions))
return new long[] {};
else if (dimensions.length == 1 && wholeShape.length == 2) {
val ret = new long[2];
if (dimensions[0] == 1) {
ret... | java | public static long[] getReducedShape(int[] wholeShape, int[] dimensions) {
if (isWholeArray(wholeShape, dimensions))
return new long[] {};
else if (dimensions.length == 1 && wholeShape.length == 2) {
val ret = new long[2];
if (dimensions[0] == 1) {
ret... | [
"public",
"static",
"long",
"[",
"]",
"getReducedShape",
"(",
"int",
"[",
"]",
"wholeShape",
",",
"int",
"[",
"]",
"dimensions",
")",
"{",
"if",
"(",
"isWholeArray",
"(",
"wholeShape",
",",
"dimensions",
")",
")",
"return",
"new",
"long",
"[",
"]",
"{"... | Get the shape of the reduced array
@param wholeShape the shape of the array
with the reduce op being performed
@param dimensions the dimensions the reduce op is being performed on
@return the shape of the result array as the result of the reduce | [
"Get",
"the",
"shape",
"of",
"the",
"reduced",
"array"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L360-L376 |
128,343 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.getMatrixMultiplyShape | public static int[] getMatrixMultiplyShape(int[] left, int[] right) {
if(Shape.shapeIsScalar(left)) {
return right;
}
if(Shape.shapeIsScalar(right)) {
return left;
}
if (left.length != 2 && right.length != 2) {
throw new IllegalArgumentExcept... | java | public static int[] getMatrixMultiplyShape(int[] left, int[] right) {
if(Shape.shapeIsScalar(left)) {
return right;
}
if(Shape.shapeIsScalar(right)) {
return left;
}
if (left.length != 2 && right.length != 2) {
throw new IllegalArgumentExcept... | [
"public",
"static",
"int",
"[",
"]",
"getMatrixMultiplyShape",
"(",
"int",
"[",
"]",
"left",
",",
"int",
"[",
"]",
"right",
")",
"{",
"if",
"(",
"Shape",
".",
"shapeIsScalar",
"(",
"left",
")",
")",
"{",
"return",
"right",
";",
"}",
"if",
"(",
"Sha... | Get the output shape of a matrix multiply
@param left the first matrix shape to multiply
@param right the second matrix shape to multiply
@return the shape of the output array (the left's rows and right's columns) | [
"Get",
"the",
"output",
"shape",
"of",
"a",
"matrix",
"multiply"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L503-L542 |
128,344 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.toOffsetZero | public static INDArray toOffsetZero(INDArray arr) {
if (arr.offset() < 1 && arr.data().length() == arr.length())
if (arr.ordering() == 'f' && arr.stride(-1) != 1
|| arr.ordering() == 'c' && arr.stride(0) != 1)
return arr;
if (arr.isRowVector()) {
... | java | public static INDArray toOffsetZero(INDArray arr) {
if (arr.offset() < 1 && arr.data().length() == arr.length())
if (arr.ordering() == 'f' && arr.stride(-1) != 1
|| arr.ordering() == 'c' && arr.stride(0) != 1)
return arr;
if (arr.isRowVector()) {
... | [
"public",
"static",
"INDArray",
"toOffsetZero",
"(",
"INDArray",
"arr",
")",
"{",
"if",
"(",
"arr",
".",
"offset",
"(",
")",
"<",
"1",
"&&",
"arr",
".",
"data",
"(",
")",
".",
"length",
"(",
")",
"==",
"arr",
".",
"length",
"(",
")",
")",
"if",
... | Create a copy of the matrix
where the new offset is zero
@param arr the array to copy to offset 0
@return the same array if offset is zero
otherwise a copy of the array with
elements set to zero | [
"Create",
"a",
"copy",
"of",
"the",
"matrix",
"where",
"the",
"new",
"offset",
"is",
"zero"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L605-L621 |
128,345 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.getDouble | public static double getDouble(INDArray arr, int[] indices) {
long offset = getOffset(arr.shapeInfo(), ArrayUtil.toLongArray(indices));
return arr.data().getDouble(offset);
} | java | public static double getDouble(INDArray arr, int[] indices) {
long offset = getOffset(arr.shapeInfo(), ArrayUtil.toLongArray(indices));
return arr.data().getDouble(offset);
} | [
"public",
"static",
"double",
"getDouble",
"(",
"INDArray",
"arr",
",",
"int",
"[",
"]",
"indices",
")",
"{",
"long",
"offset",
"=",
"getOffset",
"(",
"arr",
".",
"shapeInfo",
"(",
")",
",",
"ArrayUtil",
".",
"toLongArray",
"(",
"indices",
")",
")",
";... | Get a double based on the array and given indices
@param arr the array to retrieve the double from
@param indices the indices to iterate over
@return the double at the specified index | [
"Get",
"a",
"double",
"based",
"on",
"the",
"array",
"and",
"given",
"indices"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L679-L682 |
128,346 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.iterate | public static void iterate(int dimension, int n, int[] size, int[] res, int dimension2, int n2, int[] size2,
int[] res2, CoordinateFunction func) {
if (dimension >= n || dimension2 >= n2) {
// stop clause
func.process(ArrayUtil.toLongArray(res), ArrayUtil.t... | java | public static void iterate(int dimension, int n, int[] size, int[] res, int dimension2, int n2, int[] size2,
int[] res2, CoordinateFunction func) {
if (dimension >= n || dimension2 >= n2) {
// stop clause
func.process(ArrayUtil.toLongArray(res), ArrayUtil.t... | [
"public",
"static",
"void",
"iterate",
"(",
"int",
"dimension",
",",
"int",
"n",
",",
"int",
"[",
"]",
"size",
",",
"int",
"[",
"]",
"res",
",",
"int",
"dimension2",
",",
"int",
"n2",
",",
"int",
"[",
"]",
"size2",
",",
"int",
"[",
"]",
"res2",
... | Iterate over a pair of coordinates
@param dimension
@param n
@param size
@param res
@param dimension2
@param n2
@param size2
@param res2
@param func | [
"Iterate",
"over",
"a",
"pair",
"of",
"coordinates"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L730-L766 |
128,347 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.getOffset | public static long getOffset(long baseOffset, int[] shape, int[] stride, int... indices) {
//int ret = mappers[shape.length].getOffset(baseOffset, shape, stride, indices);
if (shape.length != stride.length || indices.length != shape.length)
throw new IllegalArgumentException("Indexes, shape... | java | public static long getOffset(long baseOffset, int[] shape, int[] stride, int... indices) {
//int ret = mappers[shape.length].getOffset(baseOffset, shape, stride, indices);
if (shape.length != stride.length || indices.length != shape.length)
throw new IllegalArgumentException("Indexes, shape... | [
"public",
"static",
"long",
"getOffset",
"(",
"long",
"baseOffset",
",",
"int",
"[",
"]",
"shape",
",",
"int",
"[",
"]",
"stride",
",",
"int",
"...",
"indices",
")",
"{",
"//int ret = mappers[shape.length].getOffset(baseOffset, shape, stride, indices);",
"if",
"(",... | Get an offset for retrieval
from a data buffer
based on the given
shape stride and given indices
@param baseOffset the offset to start from
@param shape the shape of the array
@param stride the stride of the array
@param indices the indices to iterate over
@return the double at the specified index | [
"Get",
"an",
"offset",
"for",
"retrieval",
"from",
"a",
"data",
"buffer",
"based",
"on",
"the",
"given",
"shape",
"stride",
"and",
"given",
"indices"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L848-L863 |
128,348 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.sizeForAxes | public static int[] sizeForAxes(int[] axes, int[] shape) {
int[] ret = new int[shape.length];
for (int i = 0; i < axes.length; i++) {
ret[i] = shape[axes[i]];
}
return ret;
} | java | public static int[] sizeForAxes(int[] axes, int[] shape) {
int[] ret = new int[shape.length];
for (int i = 0; i < axes.length; i++) {
ret[i] = shape[axes[i]];
}
return ret;
} | [
"public",
"static",
"int",
"[",
"]",
"sizeForAxes",
"(",
"int",
"[",
"]",
"axes",
",",
"int",
"[",
"]",
"shape",
")",
"{",
"int",
"[",
"]",
"ret",
"=",
"new",
"int",
"[",
"shape",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";"... | Output an int array for a particular dimension
@param axes the axes
@param shape the current shape
@return | [
"Output",
"an",
"int",
"array",
"for",
"a",
"particular",
"dimension"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L1291-L1297 |
128,349 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.shapeEquals | public static boolean shapeEquals(int[] shape1, int[] shape2) {
if (isColumnVectorShape(shape1) && isColumnVectorShape(shape2)) {
return Arrays.equals(shape1, shape2);
}
if (isRowVectorShape(shape1) && isRowVectorShape(shape2)) {
int[] shape1Comp = squeeze(shape1);
... | java | public static boolean shapeEquals(int[] shape1, int[] shape2) {
if (isColumnVectorShape(shape1) && isColumnVectorShape(shape2)) {
return Arrays.equals(shape1, shape2);
}
if (isRowVectorShape(shape1) && isRowVectorShape(shape2)) {
int[] shape1Comp = squeeze(shape1);
... | [
"public",
"static",
"boolean",
"shapeEquals",
"(",
"int",
"[",
"]",
"shape1",
",",
"int",
"[",
"]",
"shape2",
")",
"{",
"if",
"(",
"isColumnVectorShape",
"(",
"shape1",
")",
"&&",
"isColumnVectorShape",
"(",
"shape2",
")",
")",
"{",
"return",
"Arrays",
"... | Returns whether 2 shapes are equals by checking for dimension semantics
as well as array equality
@param shape1 the first shape for comparison
@param shape2 the second shape for comparison
@return whether the shapes are equivalent | [
"Returns",
"whether",
"2",
"shapes",
"are",
"equals",
"by",
"checking",
"for",
"dimension",
"semantics",
"as",
"well",
"as",
"array",
"equality"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L1494-L1521 |
128,350 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.getOrder | public static char getOrder(int[] shape, int[] stride, int elementStride) {
int sd;
int dim;
int i;
boolean cContiguous = true;
boolean isFortran = true;
sd = 1;
for (i = shape.length - 1; i >= 0; --i) {
dim = shape[i];
if (stride[i] != s... | java | public static char getOrder(int[] shape, int[] stride, int elementStride) {
int sd;
int dim;
int i;
boolean cContiguous = true;
boolean isFortran = true;
sd = 1;
for (i = shape.length - 1; i >= 0; --i) {
dim = shape[i];
if (stride[i] != s... | [
"public",
"static",
"char",
"getOrder",
"(",
"int",
"[",
"]",
"shape",
",",
"int",
"[",
"]",
"stride",
",",
"int",
"elementStride",
")",
"{",
"int",
"sd",
";",
"int",
"dim",
";",
"int",
"i",
";",
"boolean",
"cContiguous",
"=",
"true",
";",
"boolean",... | Infer order from
@param shape the shape to infer by
@param stride the stride to infer by
@param elementStride the element stride to start at
@return the storage order given shape and element stride | [
"Infer",
"order",
"from"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L2122-L2169 |
128,351 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.ind2subC | public static int[] ind2subC(int[] shape, long index, long numIndices) {
long denom = numIndices;
int[] ret = new int[shape.length];
for (int i = 0; i < shape.length; i++) {
denom /= shape[i];
if (index / denom >= Integer.MAX_VALUE)
throw new IllegalArgume... | java | public static int[] ind2subC(int[] shape, long index, long numIndices) {
long denom = numIndices;
int[] ret = new int[shape.length];
for (int i = 0; i < shape.length; i++) {
denom /= shape[i];
if (index / denom >= Integer.MAX_VALUE)
throw new IllegalArgume... | [
"public",
"static",
"int",
"[",
"]",
"ind2subC",
"(",
"int",
"[",
"]",
"shape",
",",
"long",
"index",
",",
"long",
"numIndices",
")",
"{",
"long",
"denom",
"=",
"numIndices",
";",
"int",
"[",
"]",
"ret",
"=",
"new",
"int",
"[",
"shape",
".",
"lengt... | Convert a linear index to
the equivalent nd index
@param shape the shape of the dimensions
@param index the index to map
@param numIndices the number of total indices (typically prod of shape(
@return the mapped indexes along each dimension | [
"Convert",
"a",
"linear",
"index",
"to",
"the",
"equivalent",
"nd",
"index"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L2334-L2346 |
128,352 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.stride | public static IntBuffer stride(IntBuffer buffer) {
int rank = rank(buffer);
val buffer2 = (Buffer) buffer;
val ret = (IntBuffer) buffer2.position(1 + rank);
return ret.slice();
} | java | public static IntBuffer stride(IntBuffer buffer) {
int rank = rank(buffer);
val buffer2 = (Buffer) buffer;
val ret = (IntBuffer) buffer2.position(1 + rank);
return ret.slice();
} | [
"public",
"static",
"IntBuffer",
"stride",
"(",
"IntBuffer",
"buffer",
")",
"{",
"int",
"rank",
"=",
"rank",
"(",
"buffer",
")",
";",
"val",
"buffer2",
"=",
"(",
"Buffer",
")",
"buffer",
";",
"val",
"ret",
"=",
"(",
"IntBuffer",
")",
"buffer2",
".",
... | Get the stride for the given
shape information buffer
@param buffer
@return | [
"Get",
"the",
"stride",
"for",
"the",
"given",
"shape",
"information",
"buffer"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L2759-L2764 |
128,353 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.shapeToString | public static String shapeToString(IntBuffer buffer) {
val shapeBuff = shapeOf(buffer);
int rank = Shape.rank(buffer);
val strideBuff = stride(buffer);
StringBuilder sb = new StringBuilder();
sb.append("Rank: " + rank + ",");
sb.append("Offset: " + Shape.offset(buffer) + ... | java | public static String shapeToString(IntBuffer buffer) {
val shapeBuff = shapeOf(buffer);
int rank = Shape.rank(buffer);
val strideBuff = stride(buffer);
StringBuilder sb = new StringBuilder();
sb.append("Rank: " + rank + ",");
sb.append("Offset: " + Shape.offset(buffer) + ... | [
"public",
"static",
"String",
"shapeToString",
"(",
"IntBuffer",
"buffer",
")",
"{",
"val",
"shapeBuff",
"=",
"shapeOf",
"(",
"buffer",
")",
";",
"int",
"rank",
"=",
"Shape",
".",
"rank",
"(",
"buffer",
")",
";",
"val",
"strideBuff",
"=",
"stride",
"(",
... | Prints the shape
for this shape information
@param buffer the shape information to print
@return the shape information to string | [
"Prints",
"the",
"shape",
"for",
"this",
"shape",
"information"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L2908-L2932 |
128,354 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.createShapeInformation | public static DataBuffer createShapeInformation(int[] shape, int[] stride, long offset, int elementWiseStride, char order) {
if (shape.length != stride.length)
throw new IllegalStateException("Shape and stride must be the same length");
int rank = shape.length;
int shapeBuffer[] = n... | java | public static DataBuffer createShapeInformation(int[] shape, int[] stride, long offset, int elementWiseStride, char order) {
if (shape.length != stride.length)
throw new IllegalStateException("Shape and stride must be the same length");
int rank = shape.length;
int shapeBuffer[] = n... | [
"public",
"static",
"DataBuffer",
"createShapeInformation",
"(",
"int",
"[",
"]",
"shape",
",",
"int",
"[",
"]",
"stride",
",",
"long",
"offset",
",",
"int",
"elementWiseStride",
",",
"char",
"order",
")",
"{",
"if",
"(",
"shape",
".",
"length",
"!=",
"s... | Creates the shape information buffer
given the shape,stride
@param shape the shape for the buffer
@param stride the stride for the buffer
@param offset the offset for the buffer
@param elementWiseStride the element wise stride for the buffer
@param order the order for the buffer
@return the shape information buffer giv... | [
"Creates",
"the",
"shape",
"information",
"buffer",
"given",
"the",
"shape",
"stride"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L3170-L3192 |
128,355 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.toBuffer | public static IntBuffer toBuffer(int... arr) {
ByteBuffer directBuffer = ByteBuffer.allocateDirect(arr.length * 4).order(ByteOrder.nativeOrder());
IntBuffer buffer = directBuffer.asIntBuffer();
for (int i = 0; i < arr.length; i++)
buffer.put(i, arr[i]);
return buffer;
} | java | public static IntBuffer toBuffer(int... arr) {
ByteBuffer directBuffer = ByteBuffer.allocateDirect(arr.length * 4).order(ByteOrder.nativeOrder());
IntBuffer buffer = directBuffer.asIntBuffer();
for (int i = 0; i < arr.length; i++)
buffer.put(i, arr[i]);
return buffer;
} | [
"public",
"static",
"IntBuffer",
"toBuffer",
"(",
"int",
"...",
"arr",
")",
"{",
"ByteBuffer",
"directBuffer",
"=",
"ByteBuffer",
".",
"allocateDirect",
"(",
"arr",
".",
"length",
"*",
"4",
")",
".",
"order",
"(",
"ByteOrder",
".",
"nativeOrder",
"(",
")",... | Convert an array to a byte buffer
@param arr the array
@return a direct byte buffer with the array contents | [
"Convert",
"an",
"array",
"to",
"a",
"byte",
"buffer"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L3280-L3287 |
128,356 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.wholeArrayDimension | public static boolean wholeArrayDimension(int... arr) {
return arr == null || arr.length == 0 || (arr.length == 1 && arr[0] == Integer.MAX_VALUE);
} | java | public static boolean wholeArrayDimension(int... arr) {
return arr == null || arr.length == 0 || (arr.length == 1 && arr[0] == Integer.MAX_VALUE);
} | [
"public",
"static",
"boolean",
"wholeArrayDimension",
"(",
"int",
"...",
"arr",
")",
"{",
"return",
"arr",
"==",
"null",
"||",
"arr",
".",
"length",
"==",
"0",
"||",
"(",
"arr",
".",
"length",
"==",
"1",
"&&",
"arr",
"[",
"0",
"]",
"==",
"Integer",
... | Returns true if the given array
is meant for the whole dimension
@param arr the array to test
@return true if arr.length == 1 && arr[0] is Integer.MAX_VALUE | [
"Returns",
"true",
"if",
"the",
"given",
"array",
"is",
"meant",
"for",
"the",
"whole",
"dimension"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L3321-L3323 |
128,357 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.isContiguousInBuffer | public static boolean isContiguousInBuffer(INDArray in) {
long length = in.length();
long dLength = in.data().length();
if (length == dLength)
return true; //full buffer, always contiguous
char order = in.ordering();
long[] shape = in.shape();
long[] strides... | java | public static boolean isContiguousInBuffer(INDArray in) {
long length = in.length();
long dLength = in.data().length();
if (length == dLength)
return true; //full buffer, always contiguous
char order = in.ordering();
long[] shape = in.shape();
long[] strides... | [
"public",
"static",
"boolean",
"isContiguousInBuffer",
"(",
"INDArray",
"in",
")",
"{",
"long",
"length",
"=",
"in",
".",
"length",
"(",
")",
";",
"long",
"dLength",
"=",
"in",
".",
"data",
"(",
")",
".",
"length",
"(",
")",
";",
"if",
"(",
"length",... | Are the elements in the buffer contiguous for this NDArray? | [
"Are",
"the",
"elements",
"in",
"the",
"buffer",
"contiguous",
"for",
"this",
"NDArray?"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L3438-L3459 |
128,358 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.toMmulCompatible | public static INDArray toMmulCompatible(INDArray input) {
if (input.rank() != 2)
throw new IllegalArgumentException("Input must be rank 2 (matrix)");
//Same conditions as GemmParams.copyIfNecessary()
boolean doCopy = false;
if (input.ordering() == 'c' && (input.stride(0) != i... | java | public static INDArray toMmulCompatible(INDArray input) {
if (input.rank() != 2)
throw new IllegalArgumentException("Input must be rank 2 (matrix)");
//Same conditions as GemmParams.copyIfNecessary()
boolean doCopy = false;
if (input.ordering() == 'c' && (input.stride(0) != i... | [
"public",
"static",
"INDArray",
"toMmulCompatible",
"(",
"INDArray",
"input",
")",
"{",
"if",
"(",
"input",
".",
"rank",
"(",
")",
"!=",
"2",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Input must be rank 2 (matrix)\"",
")",
";",
"//Same conditions as... | This method is used in DL4J LSTM implementation
@param input
@return | [
"This",
"method",
"is",
"used",
"in",
"DL4J",
"LSTM",
"implementation"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L3466-L3480 |
128,359 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java | Shape.reductionShape | public static long[] reductionShape(INDArray x, int[] dimension, boolean newFormat, boolean keepDims){
boolean wholeArray = Shape.wholeArrayDimension(dimension) || dimension.length == x.rank();
long[] retShape;
if(!newFormat) {
retShape = wholeArray ? new long[] {1, 1} : ArrayUtil.re... | java | public static long[] reductionShape(INDArray x, int[] dimension, boolean newFormat, boolean keepDims){
boolean wholeArray = Shape.wholeArrayDimension(dimension) || dimension.length == x.rank();
long[] retShape;
if(!newFormat) {
retShape = wholeArray ? new long[] {1, 1} : ArrayUtil.re... | [
"public",
"static",
"long",
"[",
"]",
"reductionShape",
"(",
"INDArray",
"x",
",",
"int",
"[",
"]",
"dimension",
",",
"boolean",
"newFormat",
",",
"boolean",
"keepDims",
")",
"{",
"boolean",
"wholeArray",
"=",
"Shape",
".",
"wholeArrayDimension",
"(",
"dimen... | Calculate the shape of the returned array, for a reduction along dimension
@param x Input array to reduce
@param dimension Dimensions/axis to reduce on
@param newFormat If new format (almost always true; will be removed eventually)
@param keepDims If reduced dimensions should be kept as size 1 dime... | [
"Calculate",
"the",
"shape",
"of",
"the",
"returned",
"array",
"for",
"a",
"reduction",
"along",
"dimension"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/shape/Shape.java#L3731-L3763 |
128,360 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/text/tokenization/tokenizerfactory/BertWordPieceTokenizerFactory.java | BertWordPieceTokenizerFactory.loadVocab | public static NavigableMap<String, Integer> loadVocab(InputStream is) throws IOException {
final TreeMap<String, Integer> map = new TreeMap<>(Collections.reverseOrder());
try (final BufferedReader reader = new BufferedReader(new InputStreamReader(is))) {
String token;
int i = 0;... | java | public static NavigableMap<String, Integer> loadVocab(InputStream is) throws IOException {
final TreeMap<String, Integer> map = new TreeMap<>(Collections.reverseOrder());
try (final BufferedReader reader = new BufferedReader(new InputStreamReader(is))) {
String token;
int i = 0;... | [
"public",
"static",
"NavigableMap",
"<",
"String",
",",
"Integer",
">",
"loadVocab",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"final",
"TreeMap",
"<",
"String",
",",
"Integer",
">",
"map",
"=",
"new",
"TreeMap",
"<>",
"(",
"Collections",
... | The expected format is a \n seperated list of tokens for examples
<code>
foo
bar
baz
</code>
the tokens should <b>not</b> have any whitespace on either of their sides
@param is InputStream
@return A vocab map with the popper sort order for fast traversal | [
"The",
"expected",
"format",
"is",
"a",
"\\",
"n",
"seperated",
"list",
"of",
"tokens",
"for",
"examples"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/text/tokenization/tokenizerfactory/BertWordPieceTokenizerFactory.java#L108-L120 |
128,361 | deeplearning4j/deeplearning4j | nd4j/nd4j-context/src/main/java/org/nd4j/linalg/factory/Nd4jBackend.java | Nd4jBackend.load | public static Nd4jBackend load() throws NoAvailableBackendException {
List<Nd4jBackend> backends = new ArrayList<>(1);
ServiceLoader<Nd4jBackend> loader = ServiceLoader.load(Nd4jBackend.class);
try {
Iterator<Nd4jBackend> backendIterator = loader.iterator();
while (back... | java | public static Nd4jBackend load() throws NoAvailableBackendException {
List<Nd4jBackend> backends = new ArrayList<>(1);
ServiceLoader<Nd4jBackend> loader = ServiceLoader.load(Nd4jBackend.class);
try {
Iterator<Nd4jBackend> backendIterator = loader.iterator();
while (back... | [
"public",
"static",
"Nd4jBackend",
"load",
"(",
")",
"throws",
"NoAvailableBackendException",
"{",
"List",
"<",
"Nd4jBackend",
">",
"backends",
"=",
"new",
"ArrayList",
"<>",
"(",
"1",
")",
";",
"ServiceLoader",
"<",
"Nd4jBackend",
">",
"loader",
"=",
"Service... | Loads the best available backend.
@return | [
"Loads",
"the",
"best",
"available",
"backend",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-context/src/main/java/org/nd4j/linalg/factory/Nd4jBackend.java#L153-L223 |
128,362 | deeplearning4j/deeplearning4j | nd4j/nd4j-context/src/main/java/org/nd4j/linalg/factory/Nd4jBackend.java | Nd4jBackend.loadLibrary | public static synchronized void loadLibrary(File jar) throws NoAvailableBackendException {
try {
/*We are using reflection here to circumvent encapsulation; addURL is not public*/
java.net.URLClassLoader loader = (java.net.URLClassLoader) ClassLoader.getSystemClassLoader();
j... | java | public static synchronized void loadLibrary(File jar) throws NoAvailableBackendException {
try {
/*We are using reflection here to circumvent encapsulation; addURL is not public*/
java.net.URLClassLoader loader = (java.net.URLClassLoader) ClassLoader.getSystemClassLoader();
j... | [
"public",
"static",
"synchronized",
"void",
"loadLibrary",
"(",
"File",
"jar",
")",
"throws",
"NoAvailableBackendException",
"{",
"try",
"{",
"/*We are using reflection here to circumvent encapsulation; addURL is not public*/",
"java",
".",
"net",
".",
"URLClassLoader",
"load... | Adds the supplied Java Archive library to java.class.path. This is benign
if the library is already loaded.
@param jar the jar file to add
@throws NoAvailableBackendException | [
"Adds",
"the",
"supplied",
"Java",
"Archive",
"library",
"to",
"java",
".",
"class",
".",
"path",
".",
"This",
"is",
"benign",
"if",
"the",
"library",
"is",
"already",
"loaded",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-context/src/main/java/org/nd4j/linalg/factory/Nd4jBackend.java#L232-L251 |
128,363 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-graph/src/main/java/org/deeplearning4j/graph/models/embeddings/GraphVectorsImpl.java | GraphVectorsImpl.similarity | @Override
public double similarity(Vertex<V> vertex1, Vertex<V> vertex2) {
return similarity(vertex1.vertexID(), vertex2.vertexID());
} | java | @Override
public double similarity(Vertex<V> vertex1, Vertex<V> vertex2) {
return similarity(vertex1.vertexID(), vertex2.vertexID());
} | [
"@",
"Override",
"public",
"double",
"similarity",
"(",
"Vertex",
"<",
"V",
">",
"vertex1",
",",
"Vertex",
"<",
"V",
">",
"vertex2",
")",
"{",
"return",
"similarity",
"(",
"vertex1",
".",
"vertexID",
"(",
")",
",",
"vertex2",
".",
"vertexID",
"(",
")",... | Returns the cosine similarity of the vector representations of two vertices in the graph
@return Cosine similarity of two vertices | [
"Returns",
"the",
"cosine",
"similarity",
"of",
"the",
"vector",
"representations",
"of",
"two",
"vertices",
"in",
"the",
"graph"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-graph/src/main/java/org/deeplearning4j/graph/models/embeddings/GraphVectorsImpl.java#L108-L111 |
128,364 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-graph/src/main/java/org/deeplearning4j/graph/models/embeddings/GraphVectorsImpl.java | GraphVectorsImpl.similarity | @Override
public double similarity(int vertexIdx1, int vertexIdx2) {
if (vertexIdx1 == vertexIdx2)
return 1.0;
INDArray vector = Transforms.unitVec(getVertexVector(vertexIdx1));
INDArray vector2 = Transforms.unitVec(getVertexVector(vertexIdx2));
return Nd4j.getBlasWrappe... | java | @Override
public double similarity(int vertexIdx1, int vertexIdx2) {
if (vertexIdx1 == vertexIdx2)
return 1.0;
INDArray vector = Transforms.unitVec(getVertexVector(vertexIdx1));
INDArray vector2 = Transforms.unitVec(getVertexVector(vertexIdx2));
return Nd4j.getBlasWrappe... | [
"@",
"Override",
"public",
"double",
"similarity",
"(",
"int",
"vertexIdx1",
",",
"int",
"vertexIdx2",
")",
"{",
"if",
"(",
"vertexIdx1",
"==",
"vertexIdx2",
")",
"return",
"1.0",
";",
"INDArray",
"vector",
"=",
"Transforms",
".",
"unitVec",
"(",
"getVertexV... | Returns the cosine similarity of the vector representations of two vertices in the graph,
given the indices of these verticies
@return Cosine similarity of two vertices | [
"Returns",
"the",
"cosine",
"similarity",
"of",
"the",
"vector",
"representations",
"of",
"two",
"vertices",
"in",
"the",
"graph",
"given",
"the",
"indices",
"of",
"these",
"verticies"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-graph/src/main/java/org/deeplearning4j/graph/models/embeddings/GraphVectorsImpl.java#L117-L125 |
128,365 | deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-audio/src/main/java/org/datavec/audio/fingerprint/MapRankDouble.java | MapRankDouble.locate | private void locate(double[] array, int left, int right, int index) {
int mid = (left + right) / 2;
//System.out.println(left+" to "+right+" ("+mid+")");
if (right == left) {
//System.out.println("* "+array[targetIndex]);
//result=array[targetIndex];
return;... | java | private void locate(double[] array, int left, int right, int index) {
int mid = (left + right) / 2;
//System.out.println(left+" to "+right+" ("+mid+")");
if (right == left) {
//System.out.println("* "+array[targetIndex]);
//result=array[targetIndex];
return;... | [
"private",
"void",
"locate",
"(",
"double",
"[",
"]",
"array",
",",
"int",
"left",
",",
"int",
"right",
",",
"int",
"index",
")",
"{",
"int",
"mid",
"=",
"(",
"left",
"+",
"right",
")",
"/",
"2",
";",
"//System.out.println(left+\" to \"+right+\" (\"+mid+\"... | sort the partitions by quick sort, and locate the target index | [
"sort",
"the",
"partitions",
"by",
"quick",
"sort",
"and",
"locate",
"the",
"target",
"index"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-audio/src/main/java/org/datavec/audio/fingerprint/MapRankDouble.java#L132-L168 |
128,366 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/graph/ui/LogFileWriter.java | LogFileWriter.writeGraphStructure | public long writeGraphStructure(SameDiff sd) throws IOException {
Preconditions.checkState(endStaticInfoOffset < 0, "Cannot write graph structure - already wrote end of static info marker");
Pair<Integer, FlatBufferBuilder> h = encodeStaticHeader(UIInfoType.GRAPH_STRUCTURE);
FlatBufferBuilder f... | java | public long writeGraphStructure(SameDiff sd) throws IOException {
Preconditions.checkState(endStaticInfoOffset < 0, "Cannot write graph structure - already wrote end of static info marker");
Pair<Integer, FlatBufferBuilder> h = encodeStaticHeader(UIInfoType.GRAPH_STRUCTURE);
FlatBufferBuilder f... | [
"public",
"long",
"writeGraphStructure",
"(",
"SameDiff",
"sd",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkState",
"(",
"endStaticInfoOffset",
"<",
"0",
",",
"\"Cannot write graph structure - already wrote end of static info marker\"",
")",
";",
"Pair",
... | Write the graph structure
@param sd SameDiff instance to write the graph structure for
@return Number of bytes written
@throws IOException | [
"Write",
"the",
"graph",
"structure"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/graph/ui/LogFileWriter.java#L86-L95 |
128,367 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/graph/ui/LogFileWriter.java | LogFileWriter.writeFinishStaticMarker | public long writeFinishStaticMarker() throws IOException {
Preconditions.checkState(endStaticInfoOffset < 0, "Wrote final static already information already");
Pair<Integer, FlatBufferBuilder> encoded = encodeStaticHeader(UIInfoType.START_EVENTS);
long out = append(encoded.getSecond(), null);
... | java | public long writeFinishStaticMarker() throws IOException {
Preconditions.checkState(endStaticInfoOffset < 0, "Wrote final static already information already");
Pair<Integer, FlatBufferBuilder> encoded = encodeStaticHeader(UIInfoType.START_EVENTS);
long out = append(encoded.getSecond(), null);
... | [
"public",
"long",
"writeFinishStaticMarker",
"(",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkState",
"(",
"endStaticInfoOffset",
"<",
"0",
",",
"\"Wrote final static already information already\"",
")",
";",
"Pair",
"<",
"Integer",
",",
"FlatBufferBu... | Write marker for final static data
@return
@throws IOException | [
"Write",
"marker",
"for",
"final",
"static",
"data"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/graph/ui/LogFileWriter.java#L103-L109 |
128,368 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/graph/ui/LogFileWriter.java | LogFileWriter.readStatic | public StaticInfo readStatic() throws IOException {
List<Pair<UIStaticInfoRecord, Table>> out = new ArrayList<>();
boolean allStaticRead = false;
try (RandomAccessFile f = new RandomAccessFile(file, "r"); FileChannel fc = f.getChannel()) {
f.seek(0);
while (!allStaticRea... | java | public StaticInfo readStatic() throws IOException {
List<Pair<UIStaticInfoRecord, Table>> out = new ArrayList<>();
boolean allStaticRead = false;
try (RandomAccessFile f = new RandomAccessFile(file, "r"); FileChannel fc = f.getChannel()) {
f.seek(0);
while (!allStaticRea... | [
"public",
"StaticInfo",
"readStatic",
"(",
")",
"throws",
"IOException",
"{",
"List",
"<",
"Pair",
"<",
"UIStaticInfoRecord",
",",
"Table",
">",
">",
"out",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"boolean",
"allStaticRead",
"=",
"false",
";",
"try",... | Read all static information at the start of the file
@return
@throws IOException | [
"Read",
"all",
"static",
"information",
"at",
"the",
"start",
"of",
"the",
"file"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/graph/ui/LogFileWriter.java#L117-L171 |
128,369 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/graph/ui/LogFileWriter.java | LogFileWriter.readEvents | public List<Pair<UIEvent, Table>> readEvents() throws IOException {
//TODO eventually we'll support working out the offset for files that were not written in this session
Preconditions.checkState(endStaticInfoOffset >= 0, "Cannot read events - have not written end of static info marker");
return... | java | public List<Pair<UIEvent, Table>> readEvents() throws IOException {
//TODO eventually we'll support working out the offset for files that were not written in this session
Preconditions.checkState(endStaticInfoOffset >= 0, "Cannot read events - have not written end of static info marker");
return... | [
"public",
"List",
"<",
"Pair",
"<",
"UIEvent",
",",
"Table",
">",
">",
"readEvents",
"(",
")",
"throws",
"IOException",
"{",
"//TODO eventually we'll support working out the offset for files that were not written in this session",
"Preconditions",
".",
"checkState",
"(",
"e... | Read all of the events.
@return All of the UI events | [
"Read",
"all",
"of",
"the",
"events",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/graph/ui/LogFileWriter.java#L178-L182 |
128,370 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/graph/ui/LogFileWriter.java | LogFileWriter.readEvents | public List<Pair<UIEvent, Table>> readEvents(long startOffset) throws IOException {
if(endStaticInfoOffset >= file.length()){
return Collections.emptyList();
}
List<Pair<UIEvent, Table>> out = new ArrayList<>();
try (RandomAccessFile f = new RandomAccessFile(file, "r"); File... | java | public List<Pair<UIEvent, Table>> readEvents(long startOffset) throws IOException {
if(endStaticInfoOffset >= file.length()){
return Collections.emptyList();
}
List<Pair<UIEvent, Table>> out = new ArrayList<>();
try (RandomAccessFile f = new RandomAccessFile(file, "r"); File... | [
"public",
"List",
"<",
"Pair",
"<",
"UIEvent",
",",
"Table",
">",
">",
"readEvents",
"(",
"long",
"startOffset",
")",
"throws",
"IOException",
"{",
"if",
"(",
"endStaticInfoOffset",
">=",
"file",
".",
"length",
"(",
")",
")",
"{",
"return",
"Collections",
... | Read all of the events starting at a specific file offset
@return All of the UI events | [
"Read",
"all",
"of",
"the",
"events",
"starting",
"at",
"a",
"specific",
"file",
"offset"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/graph/ui/LogFileWriter.java#L189-L242 |
128,371 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/graph/ui/LogFileWriter.java | LogFileWriter.registerEventName | public long registerEventName(String name) throws IOException {
Preconditions.checkState(endStaticInfoOffset >= 0, "Cannot write name - have not written end of static info marker");
FlatBufferBuilder fbb = new FlatBufferBuilder(0);
long time = System.currentTimeMillis();
int offset = UI... | java | public long registerEventName(String name) throws IOException {
Preconditions.checkState(endStaticInfoOffset >= 0, "Cannot write name - have not written end of static info marker");
FlatBufferBuilder fbb = new FlatBufferBuilder(0);
long time = System.currentTimeMillis();
int offset = UI... | [
"public",
"long",
"registerEventName",
"(",
"String",
"name",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkState",
"(",
"endStaticInfoOffset",
">=",
"0",
",",
"\"Cannot write name - have not written end of static info marker\"",
")",
";",
"FlatBufferBuilde... | Register the event name - "accuracy", "loss", etc for later use in recording events.
@param name Name to register
@return Number of bytes written | [
"Register",
"the",
"event",
"name",
"-",
"accuracy",
"loss",
"etc",
"for",
"later",
"use",
"in",
"recording",
"events",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/graph/ui/LogFileWriter.java#L249-L267 |
128,372 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/graph/ui/LogFileWriter.java | LogFileWriter.writeScalarEvent | public long writeScalarEvent(String name, long time, int iteration, int epoch, Number scalar) throws IOException {
//TODO add support for plugin, variable and frame/iter
Preconditions.checkState(indexNameMap.containsKey(name), "Name \"%s\" not yet registered", name);
int idx = indexNameMap.get(n... | java | public long writeScalarEvent(String name, long time, int iteration, int epoch, Number scalar) throws IOException {
//TODO add support for plugin, variable and frame/iter
Preconditions.checkState(indexNameMap.containsKey(name), "Name \"%s\" not yet registered", name);
int idx = indexNameMap.get(n... | [
"public",
"long",
"writeScalarEvent",
"(",
"String",
"name",
",",
"long",
"time",
",",
"int",
"iteration",
",",
"int",
"epoch",
",",
"Number",
"scalar",
")",
"throws",
"IOException",
"{",
"//TODO add support for plugin, variable and frame/iter",
"Preconditions",
".",
... | Write a single scalar event to the file
@param name Name of the event. Must be registered by {@link #registerEventName(String)} first!
@param time Timestamp
@param iteration Iteration for the event
@param epoch Epoch for the event
@param scalar Scalar value to write
@return Number of bytes wri... | [
"Write",
"a",
"single",
"scalar",
"event",
"to",
"the",
"file"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/graph/ui/LogFileWriter.java#L278-L291 |
128,373 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/linalg/jcublas/context/CudaContext.java | CudaContext.initOldStream | public void initOldStream() {
// ContextHolder.getInstance().setContext();
if (oldStream == null) {
oldStreamFromPool = false;
oldStream = new cudaStream_t(nativeOps.createStream());
//JCuda.cudaStreamCreate(oldStream);
specialStream = new cudaStre... | java | public void initOldStream() {
// ContextHolder.getInstance().setContext();
if (oldStream == null) {
oldStreamFromPool = false;
oldStream = new cudaStream_t(nativeOps.createStream());
//JCuda.cudaStreamCreate(oldStream);
specialStream = new cudaStre... | [
"public",
"void",
"initOldStream",
"(",
")",
"{",
"// ContextHolder.getInstance().setContext();",
"if",
"(",
"oldStream",
"==",
"null",
")",
"{",
"oldStreamFromPool",
"=",
"false",
";",
"oldStream",
"=",
"new",
"cudaStream_t",
"(",
"nativeOps",
".",
"createSt... | Initializes the old stream | [
"Initializes",
"the",
"old",
"stream"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/linalg/jcublas/context/CudaContext.java#L184-L195 |
128,374 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/linalg/jcublas/context/CudaContext.java | CudaContext.getBlasContext | public static CudaContext getBlasContext() {
CudaContext context = (CudaContext) AtomicAllocator.getInstance().getDeviceContext().getContext();
//context.syncOldStream(false);
return context;
} | java | public static CudaContext getBlasContext() {
CudaContext context = (CudaContext) AtomicAllocator.getInstance().getDeviceContext().getContext();
//context.syncOldStream(false);
return context;
} | [
"public",
"static",
"CudaContext",
"getBlasContext",
"(",
")",
"{",
"CudaContext",
"context",
"=",
"(",
"CudaContext",
")",
"AtomicAllocator",
".",
"getInstance",
"(",
")",
".",
"getDeviceContext",
"(",
")",
".",
"getContext",
"(",
")",
";",
"//context.syncOldSt... | Sets up a context with an old stream
and a blas handle
@return the cuda context
as setup for cublas usage | [
"Sets",
"up",
"a",
"context",
"with",
"an",
"old",
"stream",
"and",
"a",
"blas",
"handle"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/linalg/jcublas/context/CudaContext.java#L250-L254 |
128,375 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/solvers/accumulation/BasicGradientsAccumulator.java | BasicGradientsAccumulator.receiveUpdate | @Override
public void receiveUpdate(INDArray array) {
extCounter.getAndIncrement();
updatesLock.writeLock().lock();
if (updates == null) {
try (MemoryWorkspace workspace = Nd4j.getMemoryManager().scopeOutOfWorkspaces()) {
// TODO: this one has to be HOST-only if... | java | @Override
public void receiveUpdate(INDArray array) {
extCounter.getAndIncrement();
updatesLock.writeLock().lock();
if (updates == null) {
try (MemoryWorkspace workspace = Nd4j.getMemoryManager().scopeOutOfWorkspaces()) {
// TODO: this one has to be HOST-only if... | [
"@",
"Override",
"public",
"void",
"receiveUpdate",
"(",
"INDArray",
"array",
")",
"{",
"extCounter",
".",
"getAndIncrement",
"(",
")",
";",
"updatesLock",
".",
"writeLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"if",
"(",
"updates",
"==",
"null",
")",
... | This method accepts updates suitable for StepFunction and puts them to the queue, which is used in backpropagation loop
PLEASE NOTE: array is expected to be ready for use and match params dimensionality
@param array | [
"This",
"method",
"accepts",
"updates",
"suitable",
"for",
"StepFunction",
"and",
"puts",
"them",
"to",
"the",
"queue",
"which",
"is",
"used",
"in",
"backpropagation",
"loop"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/optimize/solvers/accumulation/BasicGradientsAccumulator.java#L248-L270 |
128,376 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/layers/samediff/SDVertexParams.java | SDVertexParams.defineInputs | public void defineInputs(String... inputNames) {
Preconditions.checkArgument(inputNames != null && inputNames.length > 0,
"Input names must not be null, and must have length > 0: got %s", inputNames);
this.inputs = Arrays.asList(inputNames);
} | java | public void defineInputs(String... inputNames) {
Preconditions.checkArgument(inputNames != null && inputNames.length > 0,
"Input names must not be null, and must have length > 0: got %s", inputNames);
this.inputs = Arrays.asList(inputNames);
} | [
"public",
"void",
"defineInputs",
"(",
"String",
"...",
"inputNames",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"inputNames",
"!=",
"null",
"&&",
"inputNames",
".",
"length",
">",
"0",
",",
"\"Input names must not be null, and must have length > 0: got %s\""... | Define the inputs to the DL4J SameDiff Vertex with specific names
@param inputNames Names of the inputs. Number here also defines the number of vertex inputs
@see #defineInputs(int) | [
"Define",
"the",
"inputs",
"to",
"the",
"DL4J",
"SameDiff",
"Vertex",
"with",
"specific",
"names"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/layers/samediff/SDVertexParams.java#L40-L44 |
128,377 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/layers/samediff/SDVertexParams.java | SDVertexParams.defineInputs | public void defineInputs(int numInputs) {
Preconditions.checkArgument(numInputs > 0, "Number of inputs must be > 0: Got %s", numInputs);
String[] inputNames = new String[numInputs];
for (int i = 0; i < numInputs; i++) {
inputNames[i] = "input_" + i;
}
} | java | public void defineInputs(int numInputs) {
Preconditions.checkArgument(numInputs > 0, "Number of inputs must be > 0: Got %s", numInputs);
String[] inputNames = new String[numInputs];
for (int i = 0; i < numInputs; i++) {
inputNames[i] = "input_" + i;
}
} | [
"public",
"void",
"defineInputs",
"(",
"int",
"numInputs",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"numInputs",
">",
"0",
",",
"\"Number of inputs must be > 0: Got %s\"",
",",
"numInputs",
")",
";",
"String",
"[",
"]",
"inputNames",
"=",
"new",
"St... | Define the inputs to the DL4J SameDiff vertex with generated names. Names will have format "input_0", "input_1", etc
@param numInputs Number of inputs to the vertex. | [
"Define",
"the",
"inputs",
"to",
"the",
"DL4J",
"SameDiff",
"vertex",
"with",
"generated",
"names",
".",
"Names",
"will",
"have",
"format",
"input_0",
"input_1",
"etc"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/layers/samediff/SDVertexParams.java#L51-L57 |
128,378 | deeplearning4j/deeplearning4j | datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkUtils.java | SparkUtils.registerKryoClasses | public static void registerKryoClasses(SparkConf conf) {
List<Class<?>> classes = Arrays.<Class<?>>asList(BooleanWritable.class, ByteWritable.class,
DoubleWritable.class, FloatWritable.class, IntWritable.class, LongWritable.class,
NullWritable.class, Text.class);
... | java | public static void registerKryoClasses(SparkConf conf) {
List<Class<?>> classes = Arrays.<Class<?>>asList(BooleanWritable.class, ByteWritable.class,
DoubleWritable.class, FloatWritable.class, IntWritable.class, LongWritable.class,
NullWritable.class, Text.class);
... | [
"public",
"static",
"void",
"registerKryoClasses",
"(",
"SparkConf",
"conf",
")",
"{",
"List",
"<",
"Class",
"<",
"?",
">",
">",
"classes",
"=",
"Arrays",
".",
"<",
"Class",
"<",
"?",
">",
">",
"asList",
"(",
"BooleanWritable",
".",
"class",
",",
"Byte... | Register the DataVec writable classes for Kryo | [
"Register",
"the",
"DataVec",
"writable",
"classes",
"for",
"Kryo"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkUtils.java#L274-L280 |
128,379 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/sequencevectors/transformers/impl/GraphTransformer.java | GraphTransformer.initialize | protected void initialize() {
log.info("Building Huffman tree for source graph...");
int nVertices = sourceGraph.numVertices();
//int[] degrees = new int[nVertices];
//for( int i=0; i<nVertices; i++ )
// degrees[i] = sourceGraph.getVertexDegree(i);
/*
for (int y =... | java | protected void initialize() {
log.info("Building Huffman tree for source graph...");
int nVertices = sourceGraph.numVertices();
//int[] degrees = new int[nVertices];
//for( int i=0; i<nVertices; i++ )
// degrees[i] = sourceGraph.getVertexDegree(i);
/*
for (int y =... | [
"protected",
"void",
"initialize",
"(",
")",
"{",
"log",
".",
"info",
"(",
"\"Building Huffman tree for source graph...\"",
")",
";",
"int",
"nVertices",
"=",
"sourceGraph",
".",
"numVertices",
"(",
")",
";",
"//int[] degrees = new int[nVertices];",
"//for( int i=0; i<n... | This method handles required initialization for GraphTransformer | [
"This",
"method",
"handles",
"required",
"initialization",
"for",
"GraphTransformer"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/sequencevectors/transformers/impl/GraphTransformer.java#L54-L83 |
128,380 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/imports/graphmapper/BaseGraphMapper.java | BaseGraphMapper.importGraph | @Override
public SameDiff importGraph(GRAPH_TYPE tfGraph) {
return importGraph(tfGraph, Collections.<String, OpImportOverride<GRAPH_TYPE,NODE_TYPE,ATTR_TYPE>>emptyMap(), null);
} | java | @Override
public SameDiff importGraph(GRAPH_TYPE tfGraph) {
return importGraph(tfGraph, Collections.<String, OpImportOverride<GRAPH_TYPE,NODE_TYPE,ATTR_TYPE>>emptyMap(), null);
} | [
"@",
"Override",
"public",
"SameDiff",
"importGraph",
"(",
"GRAPH_TYPE",
"tfGraph",
")",
"{",
"return",
"importGraph",
"(",
"tfGraph",
",",
"Collections",
".",
"<",
"String",
",",
"OpImportOverride",
"<",
"GRAPH_TYPE",
",",
"NODE_TYPE",
",",
"ATTR_TYPE",
">",
... | This method converts given TF
@param tfGraph
@return | [
"This",
"method",
"converts",
"given",
"TF"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/imports/graphmapper/BaseGraphMapper.java#L165-L168 |
128,381 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/vptree/VPTree.java | VPTree.buildFromData | public static INDArray buildFromData(List<DataPoint> data) {
INDArray ret = Nd4j.create(data.size(), data.get(0).getD());
for (int i = 0; i < ret.slices(); i++)
ret.putSlice(i, data.get(i).getPoint());
return ret;
} | java | public static INDArray buildFromData(List<DataPoint> data) {
INDArray ret = Nd4j.create(data.size(), data.get(0).getD());
for (int i = 0; i < ret.slices(); i++)
ret.putSlice(i, data.get(i).getPoint());
return ret;
} | [
"public",
"static",
"INDArray",
"buildFromData",
"(",
"List",
"<",
"DataPoint",
">",
"data",
")",
"{",
"INDArray",
"ret",
"=",
"Nd4j",
".",
"create",
"(",
"data",
".",
"size",
"(",
")",
",",
"data",
".",
"get",
"(",
"0",
")",
".",
"getD",
"(",
")",... | Create an ndarray
from the datapoints
@param data
@return | [
"Create",
"an",
"ndarray",
"from",
"the",
"datapoints"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/vptree/VPTree.java#L192-L197 |
128,382 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java | SDBaseOps.max | public SDVariable max(String name, SDVariable x, int... dimensions) {
return max(name, x, false, dimensions);
} | java | public SDVariable max(String name, SDVariable x, int... dimensions) {
return max(name, x, false, dimensions);
} | [
"public",
"SDVariable",
"max",
"(",
"String",
"name",
",",
"SDVariable",
"x",
",",
"int",
"...",
"dimensions",
")",
"{",
"return",
"max",
"(",
"name",
",",
"x",
",",
"false",
",",
"dimensions",
")",
";",
"}"
] | Max array reduction operation, optionally along specified dimensions
@param name Output variable name
@param x Input variable
@param dimensions Dimensions to reduce over. If dimensions are not specified, full array reduction is performed
@return Reduced array of rank (input rank - num dimensions) | [
"Max",
"array",
"reduction",
"operation",
"optionally",
"along",
"specified",
"dimensions"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L1053-L1055 |
128,383 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java | SDBaseOps.prod | public SDVariable prod(String name, SDVariable x, int... dimensions) {
return prod(name, x, false, dimensions);
} | java | public SDVariable prod(String name, SDVariable x, int... dimensions) {
return prod(name, x, false, dimensions);
} | [
"public",
"SDVariable",
"prod",
"(",
"String",
"name",
",",
"SDVariable",
"x",
",",
"int",
"...",
"dimensions",
")",
"{",
"return",
"prod",
"(",
"name",
",",
"x",
",",
"false",
",",
"dimensions",
")",
";",
"}"
] | Product array reduction operation, optionally along specified dimensions
@param name Output variable name
@param x Input variable
@param dimensions Dimensions to reduce over. If dimensions are not specified, full array reduction is performed
@return Output variable: reduced array of rank (input rank - n... | [
"Product",
"array",
"reduction",
"operation",
"optionally",
"along",
"specified",
"dimensions"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L1599-L1601 |
128,384 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java | SDBaseOps.scalarSet | public SDVariable scalarSet(SDVariable in, Number set) {
return scalarSet(null, in, set);
} | java | public SDVariable scalarSet(SDVariable in, Number set) {
return scalarSet(null, in, set);
} | [
"public",
"SDVariable",
"scalarSet",
"(",
"SDVariable",
"in",
",",
"Number",
"set",
")",
"{",
"return",
"scalarSet",
"(",
"null",
",",
"in",
",",
"set",
")",
";",
"}"
] | Return an array with equal shape to the input, but all elements set to value 'set'
@param in Input variable
@param set Value to set
@return Output variable | [
"Return",
"an",
"array",
"with",
"equal",
"shape",
"to",
"the",
"input",
"but",
"all",
"elements",
"set",
"to",
"value",
"set"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L1993-L1995 |
128,385 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java | SDBaseOps.scalarSet | public SDVariable scalarSet(String name, SDVariable in, Number set) {
SDVariable ret = f().scalarSet(in, set);
return updateVariableNameAndReference(ret, name);
} | java | public SDVariable scalarSet(String name, SDVariable in, Number set) {
SDVariable ret = f().scalarSet(in, set);
return updateVariableNameAndReference(ret, name);
} | [
"public",
"SDVariable",
"scalarSet",
"(",
"String",
"name",
",",
"SDVariable",
"in",
",",
"Number",
"set",
")",
"{",
"SDVariable",
"ret",
"=",
"f",
"(",
")",
".",
"scalarSet",
"(",
"in",
",",
"set",
")",
";",
"return",
"updateVariableNameAndReference",
"("... | Return a variable with equal shape to the input, but all elements set to value 'set'
@param name Name of the output variable
@param in Input variable
@param set Value to set
@return Output variable | [
"Return",
"a",
"variable",
"with",
"equal",
"shape",
"to",
"the",
"input",
"but",
"all",
"elements",
"set",
"to",
"value",
"set"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L2005-L2008 |
128,386 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java | SDBaseOps.shape | public SDVariable shape(String name, SDVariable input) {
SDVariable ret = f().shape(input);
return updateVariableNameAndReference(ret, name);
} | java | public SDVariable shape(String name, SDVariable input) {
SDVariable ret = f().shape(input);
return updateVariableNameAndReference(ret, name);
} | [
"public",
"SDVariable",
"shape",
"(",
"String",
"name",
",",
"SDVariable",
"input",
")",
"{",
"SDVariable",
"ret",
"=",
"f",
"(",
")",
".",
"shape",
"(",
"input",
")",
";",
"return",
"updateVariableNameAndReference",
"(",
"ret",
",",
"name",
")",
";",
"}... | Returns the shape of the specified SDVariable as a 1D SDVariable
@param name Name of the output variable
@param input Input variable
@return 1D output variable with contents equal to the shape of the input | [
"Returns",
"the",
"shape",
"of",
"the",
"specified",
"SDVariable",
"as",
"a",
"1D",
"SDVariable"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L2399-L2402 |
128,387 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java | SDBaseOps.standardDeviation | public SDVariable standardDeviation(String name, SDVariable x, boolean biasCorrected, int... dimensions) {
return standardDeviation(name, x, biasCorrected, false, dimensions);
} | java | public SDVariable standardDeviation(String name, SDVariable x, boolean biasCorrected, int... dimensions) {
return standardDeviation(name, x, biasCorrected, false, dimensions);
} | [
"public",
"SDVariable",
"standardDeviation",
"(",
"String",
"name",
",",
"SDVariable",
"x",
",",
"boolean",
"biasCorrected",
",",
"int",
"...",
"dimensions",
")",
"{",
"return",
"standardDeviation",
"(",
"name",
",",
"x",
",",
"biasCorrected",
",",
"false",
",... | Stardard deviation array reduction operation, optionally along specified dimensions
@param name Output variable name
@param x Input variable
@param biasCorrected If true: divide by (N-1) (i.e., sample stdev). If false: divide by N (population stdev)
@param dimensions Dimensions to reduce over. ... | [
"Stardard",
"deviation",
"array",
"reduction",
"operation",
"optionally",
"along",
"specified",
"dimensions"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L2581-L2583 |
128,388 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java | SDBaseOps.sum | public SDVariable sum(String name, SDVariable x, int... dimensions) {
return sum(name, x, false, dimensions);
} | java | public SDVariable sum(String name, SDVariable x, int... dimensions) {
return sum(name, x, false, dimensions);
} | [
"public",
"SDVariable",
"sum",
"(",
"String",
"name",
",",
"SDVariable",
"x",
",",
"int",
"...",
"dimensions",
")",
"{",
"return",
"sum",
"(",
"name",
",",
"x",
",",
"false",
",",
"dimensions",
")",
";",
"}"
] | Sum array reduction operation, optionally along specified dimensions
@param x Input variable
@param dimensions Dimensions to reduce over. If dimensions are not specified, full array reduction is performed
@return Output variable: reduced array of rank (input rank - num dimensions) if keepDims = false, or
of r... | [
"Sum",
"array",
"reduction",
"operation",
"optionally",
"along",
"specified",
"dimensions"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L2724-L2726 |
128,389 | deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/transform/condition/column/BooleanColumnCondition.java | BooleanColumnCondition.columnCondition | @Override
public boolean columnCondition(Writable writable) {
BooleanWritable booleanWritable = (BooleanWritable) writable;
return booleanWritable.get();
} | java | @Override
public boolean columnCondition(Writable writable) {
BooleanWritable booleanWritable = (BooleanWritable) writable;
return booleanWritable.get();
} | [
"@",
"Override",
"public",
"boolean",
"columnCondition",
"(",
"Writable",
"writable",
")",
"{",
"BooleanWritable",
"booleanWritable",
"=",
"(",
"BooleanWritable",
")",
"writable",
";",
"return",
"booleanWritable",
".",
"get",
"(",
")",
";",
"}"
] | Returns whether the given element
meets the condition set by this operation
@param writable the element to test
@return true if the condition is met
false otherwise | [
"Returns",
"whether",
"the",
"given",
"element",
"meets",
"the",
"condition",
"set",
"by",
"this",
"operation"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/transform/condition/column/BooleanColumnCondition.java#L41-L45 |
128,390 | deeplearning4j/deeplearning4j | datavec/datavec-perf/src/main/java/org/datavec/perf/timing/TimingStatistics.java | TimingStatistics.add | public TimingStatistics add(TimingStatistics timingStatistics) {
return TimingStatistics.builder()
.ndarrayCreationTimeNanos(ndarrayCreationTimeNanos + timingStatistics.ndarrayCreationTimeNanos)
.bandwidthNanosHostToDevice(bandwidthNanosHostToDevice + timingStatistics.bandwidthNa... | java | public TimingStatistics add(TimingStatistics timingStatistics) {
return TimingStatistics.builder()
.ndarrayCreationTimeNanos(ndarrayCreationTimeNanos + timingStatistics.ndarrayCreationTimeNanos)
.bandwidthNanosHostToDevice(bandwidthNanosHostToDevice + timingStatistics.bandwidthNa... | [
"public",
"TimingStatistics",
"add",
"(",
"TimingStatistics",
"timingStatistics",
")",
"{",
"return",
"TimingStatistics",
".",
"builder",
"(",
")",
".",
"ndarrayCreationTimeNanos",
"(",
"ndarrayCreationTimeNanos",
"+",
"timingStatistics",
".",
"ndarrayCreationTimeNanos",
... | Accumulate the given statistics
@param timingStatistics the statistics to add
@return the added statistics | [
"Accumulate",
"the",
"given",
"statistics"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-perf/src/main/java/org/datavec/perf/timing/TimingStatistics.java#L47-L54 |
128,391 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/NDArrayMath.java | NDArrayMath.lengthPerSlice | public static long lengthPerSlice(INDArray arr, int... dimension) {
long[] remove = ArrayUtil.removeIndex(arr.shape(), dimension);
return ArrayUtil.prodLong(remove);
} | java | public static long lengthPerSlice(INDArray arr, int... dimension) {
long[] remove = ArrayUtil.removeIndex(arr.shape(), dimension);
return ArrayUtil.prodLong(remove);
} | [
"public",
"static",
"long",
"lengthPerSlice",
"(",
"INDArray",
"arr",
",",
"int",
"...",
"dimension",
")",
"{",
"long",
"[",
"]",
"remove",
"=",
"ArrayUtil",
".",
"removeIndex",
"(",
"arr",
".",
"shape",
"(",
")",
",",
"dimension",
")",
";",
"return",
... | The number of elements in a slice
along a set of dimensions
@param arr the array
to calculate the length per slice for
@param dimension the dimensions to do the calculations along
@return the number of elements in a slice along
arbitrary dimensions | [
"The",
"number",
"of",
"elements",
"in",
"a",
"slice",
"along",
"a",
"set",
"of",
"dimensions"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/NDArrayMath.java#L49-L52 |
128,392 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/NDArrayMath.java | NDArrayMath.numVectors | public static long numVectors(INDArray arr) {
if (arr.rank() == 1)
return 1;
else if (arr.rank() == 2)
return arr.size(0);
else {
int prod = 1;
for (int i = 0; i < arr.rank() - 1; i++) {
prod *= arr.size(i);
}
... | java | public static long numVectors(INDArray arr) {
if (arr.rank() == 1)
return 1;
else if (arr.rank() == 2)
return arr.size(0);
else {
int prod = 1;
for (int i = 0; i < arr.rank() - 1; i++) {
prod *= arr.size(i);
}
... | [
"public",
"static",
"long",
"numVectors",
"(",
"INDArray",
"arr",
")",
"{",
"if",
"(",
"arr",
".",
"rank",
"(",
")",
"==",
"1",
")",
"return",
"1",
";",
"else",
"if",
"(",
"arr",
".",
"rank",
"(",
")",
"==",
"2",
")",
"return",
"arr",
".",
"siz... | Return the number of vectors for an array
the number of vectors for an array
@param arr the array to calculate the number of vectors for
@return the number of vectors for the given array | [
"Return",
"the",
"number",
"of",
"vectors",
"for",
"an",
"array",
"the",
"number",
"of",
"vectors",
"for",
"an",
"array"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/NDArrayMath.java#L70-L83 |
128,393 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/NDArrayMath.java | NDArrayMath.sliceOffsetForTensor | public static long sliceOffsetForTensor(int index, INDArray arr, int[] tensorShape) {
long tensorLength = ArrayUtil.prodLong(tensorShape);
long lengthPerSlice = NDArrayMath.lengthPerSlice(arr);
long offset = index * tensorLength / lengthPerSlice;
return offset;
} | java | public static long sliceOffsetForTensor(int index, INDArray arr, int[] tensorShape) {
long tensorLength = ArrayUtil.prodLong(tensorShape);
long lengthPerSlice = NDArrayMath.lengthPerSlice(arr);
long offset = index * tensorLength / lengthPerSlice;
return offset;
} | [
"public",
"static",
"long",
"sliceOffsetForTensor",
"(",
"int",
"index",
",",
"INDArray",
"arr",
",",
"int",
"[",
"]",
"tensorShape",
")",
"{",
"long",
"tensorLength",
"=",
"ArrayUtil",
".",
"prodLong",
"(",
"tensorShape",
")",
";",
"long",
"lengthPerSlice",
... | calculates the offset for a tensor
@param index
@param arr
@param tensorShape
@return | [
"calculates",
"the",
"offset",
"for",
"a",
"tensor"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/NDArrayMath.java#L160-L165 |
128,394 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/NDArrayMath.java | NDArrayMath.mapIndexOntoTensor | public static int mapIndexOntoTensor(int index, INDArray arr, int... rank) {
int ret = index * ArrayUtil.prod(ArrayUtil.removeIndex(arr.shape(), rank));
return ret;
} | java | public static int mapIndexOntoTensor(int index, INDArray arr, int... rank) {
int ret = index * ArrayUtil.prod(ArrayUtil.removeIndex(arr.shape(), rank));
return ret;
} | [
"public",
"static",
"int",
"mapIndexOntoTensor",
"(",
"int",
"index",
",",
"INDArray",
"arr",
",",
"int",
"...",
"rank",
")",
"{",
"int",
"ret",
"=",
"index",
"*",
"ArrayUtil",
".",
"prod",
"(",
"ArrayUtil",
".",
"removeIndex",
"(",
"arr",
".",
"shape",
... | This maps an index of a vector
on to a vector in the matrix that can be used
for indexing in to a tensor
@param index the index to map
@param arr the array to use
for indexing
@param rank the dimensions to compute a slice for
@return the mapped index | [
"This",
"maps",
"an",
"index",
"of",
"a",
"vector",
"on",
"to",
"a",
"vector",
"in",
"the",
"matrix",
"that",
"can",
"be",
"used",
"for",
"indexing",
"in",
"to",
"a",
"tensor"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/NDArrayMath.java#L185-L188 |
128,395 | deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-audio/src/main/java/org/datavec/audio/fingerprint/PairManager.java | PairManager.getPair_PositionList_Table | public HashMap<Integer, List<Integer>> getPair_PositionList_Table(byte[] fingerprint) {
List<int[]> pairPositionList = getPairPositionList(fingerprint);
// table to store pair:pos,pos,pos,...;pair2:pos,pos,pos,....
HashMap<Integer, List<Integer>> pair_positionList_table = new HashMap<>();
... | java | public HashMap<Integer, List<Integer>> getPair_PositionList_Table(byte[] fingerprint) {
List<int[]> pairPositionList = getPairPositionList(fingerprint);
// table to store pair:pos,pos,pos,...;pair2:pos,pos,pos,....
HashMap<Integer, List<Integer>> pair_positionList_table = new HashMap<>();
... | [
"public",
"HashMap",
"<",
"Integer",
",",
"List",
"<",
"Integer",
">",
">",
"getPair_PositionList_Table",
"(",
"byte",
"[",
"]",
"fingerprint",
")",
"{",
"List",
"<",
"int",
"[",
"]",
">",
"pairPositionList",
"=",
"getPairPositionList",
"(",
"fingerprint",
"... | Get a pair-positionList table
It's a hash map which the key is the hashed pair, and the value is list of positions
That means the table stores the positions which have the same hashed pair
@param fingerprint fingerprint bytes
@return pair-positionList HashMap | [
"Get",
"a",
"pair",
"-",
"positionList",
"table",
"It",
"s",
"a",
"hash",
"map",
"which",
"the",
"key",
"is",
"the",
"hashed",
"pair",
"and",
"the",
"value",
"is",
"list",
"of",
"positions",
"That",
"means",
"the",
"table",
"stores",
"the",
"positions",
... | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-audio/src/main/java/org/datavec/audio/fingerprint/PairManager.java#L77-L101 |
128,396 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPForest.java | RPForest.fit | public void fit(INDArray x) {
this.data = x;
for(int i = 0; i < numTrees; i++) {
RPTree tree = new RPTree(data.columns(),maxSize,similarityFunction);
tree.buildTree(x);
trees.add(tree);
}
} | java | public void fit(INDArray x) {
this.data = x;
for(int i = 0; i < numTrees; i++) {
RPTree tree = new RPTree(data.columns(),maxSize,similarityFunction);
tree.buildTree(x);
trees.add(tree);
}
} | [
"public",
"void",
"fit",
"(",
"INDArray",
"x",
")",
"{",
"this",
".",
"data",
"=",
"x",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numTrees",
";",
"i",
"++",
")",
"{",
"RPTree",
"tree",
"=",
"new",
"RPTree",
"(",
"data",
".",
"col... | Build the trees from the given dataset
@param x the input dataset (should be a 2d matrix) | [
"Build",
"the",
"trees",
"from",
"the",
"given",
"dataset"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPForest.java#L58-L65 |
128,397 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPForest.java | RPForest.queryAll | public INDArray queryAll(INDArray toQuery,int n) {
return RPUtils.queryAll(toQuery,data,trees,n,similarityFunction);
} | java | public INDArray queryAll(INDArray toQuery,int n) {
return RPUtils.queryAll(toQuery,data,trees,n,similarityFunction);
} | [
"public",
"INDArray",
"queryAll",
"(",
"INDArray",
"toQuery",
",",
"int",
"n",
")",
"{",
"return",
"RPUtils",
".",
"queryAll",
"(",
"toQuery",
",",
"data",
",",
"trees",
",",
"n",
",",
"similarityFunction",
")",
";",
"}"
] | Query results up to length n
nearest neighbors
@param toQuery the query item
@param n the number of nearest neighbors for the given data point
@return the indices for the nearest neighbors | [
"Query",
"results",
"up",
"to",
"length",
"n",
"nearest",
"neighbors"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPForest.java#L83-L85 |
128,398 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-uima/src/main/java/org/deeplearning4j/text/corpora/treeparser/TreeFactory.java | TreeFactory.toTree | public static Tree toTree(TreebankNode node, Pair<String, MultiDimensionalMap<Integer, Integer, String>> labels)
throws Exception {
List<String> tokens = tokens(node);
Tree ret = new Tree(tokens);
ret.setValue(node.getNodeValue());
ret.setLabel(node.getNodeType());
... | java | public static Tree toTree(TreebankNode node, Pair<String, MultiDimensionalMap<Integer, Integer, String>> labels)
throws Exception {
List<String> tokens = tokens(node);
Tree ret = new Tree(tokens);
ret.setValue(node.getNodeValue());
ret.setLabel(node.getNodeType());
... | [
"public",
"static",
"Tree",
"toTree",
"(",
"TreebankNode",
"node",
",",
"Pair",
"<",
"String",
",",
"MultiDimensionalMap",
"<",
"Integer",
",",
"Integer",
",",
"String",
">",
">",
"labels",
")",
"throws",
"Exception",
"{",
"List",
"<",
"String",
">",
"toke... | Converts a treebank node to a tree
@param node the node to convert
@param labels the labels to assign for each span
@return the tree with the same tokens and type as
the given tree bank node
@throws Exception | [
"Converts",
"a",
"treebank",
"node",
"to",
"a",
"tree"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-uima/src/main/java/org/deeplearning4j/text/corpora/treeparser/TreeFactory.java#L90-L105 |
128,399 | deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/io/WritableUtils.java | WritableUtils.getVIntSize | public static int getVIntSize(long i) {
if (i >= -112 && i <= 127) {
return 1;
}
if (i < 0) {
i ^= -1L; // take one's complement'
}
// find the number of bytes with non-leading zeros
int dataBits = Long.SIZE - Long.numberOfLeadingZeros(i);
... | java | public static int getVIntSize(long i) {
if (i >= -112 && i <= 127) {
return 1;
}
if (i < 0) {
i ^= -1L; // take one's complement'
}
// find the number of bytes with non-leading zeros
int dataBits = Long.SIZE - Long.numberOfLeadingZeros(i);
... | [
"public",
"static",
"int",
"getVIntSize",
"(",
"long",
"i",
")",
"{",
"if",
"(",
"i",
">=",
"-",
"112",
"&&",
"i",
"<=",
"127",
")",
"{",
"return",
"1",
";",
"}",
"if",
"(",
"i",
"<",
"0",
")",
"{",
"i",
"^=",
"-",
"1L",
";",
"// take one's c... | Get the encoded length if an integer is stored in a variable-length format
@return the encoded length | [
"Get",
"the",
"encoded",
"length",
"if",
"an",
"integer",
"is",
"stored",
"in",
"a",
"variable",
"-",
"length",
"format"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/io/WritableUtils.java#L347-L359 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.