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,400 | deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/io/WritableUtils.java | WritableUtils.readEnum | public static <T extends Enum<T>> T readEnum(DataInput in, Class<T> enumType) throws IOException {
return T.valueOf(enumType, Text.readString(in));
} | java | public static <T extends Enum<T>> T readEnum(DataInput in, Class<T> enumType) throws IOException {
return T.valueOf(enumType, Text.readString(in));
} | [
"public",
"static",
"<",
"T",
"extends",
"Enum",
"<",
"T",
">",
">",
"T",
"readEnum",
"(",
"DataInput",
"in",
",",
"Class",
"<",
"T",
">",
"enumType",
")",
"throws",
"IOException",
"{",
"return",
"T",
".",
"valueOf",
"(",
"enumType",
",",
"Text",
"."... | Read an Enum value from DataInput, Enums are read and written
using String values.
@param <T> Enum type
@param in DataInput to read from
@param enumType Class type of Enum
@return Enum represented by String read from DataInput
@throws IOException | [
"Read",
"an",
"Enum",
"value",
"from",
"DataInput",
"Enums",
"are",
"read",
"and",
"written",
"using",
"String",
"values",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/io/WritableUtils.java#L370-L372 |
128,401 | deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/io/WritableUtils.java | WritableUtils.writeEnum | public static void writeEnum(DataOutput out, Enum<?> enumVal) throws IOException {
Text.writeString(out, enumVal.name());
} | java | public static void writeEnum(DataOutput out, Enum<?> enumVal) throws IOException {
Text.writeString(out, enumVal.name());
} | [
"public",
"static",
"void",
"writeEnum",
"(",
"DataOutput",
"out",
",",
"Enum",
"<",
"?",
">",
"enumVal",
")",
"throws",
"IOException",
"{",
"Text",
".",
"writeString",
"(",
"out",
",",
"enumVal",
".",
"name",
"(",
")",
")",
";",
"}"
] | writes String value of enum to DataOutput.
@param out Dataoutput stream
@param enumVal enum value
@throws IOException | [
"writes",
"String",
"value",
"of",
"enum",
"to",
"DataOutput",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/io/WritableUtils.java#L380-L382 |
128,402 | deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/io/WritableUtils.java | WritableUtils.toByteArray | public static byte[] toByteArray(Writable... writables) {
final DataOutputBuffer out = new DataOutputBuffer();
try {
for (Writable w : writables) {
w.write(out);
}
out.close();
} catch (IOException e) {
throw new RuntimeException("F... | java | public static byte[] toByteArray(Writable... writables) {
final DataOutputBuffer out = new DataOutputBuffer();
try {
for (Writable w : writables) {
w.write(out);
}
out.close();
} catch (IOException e) {
throw new RuntimeException("F... | [
"public",
"static",
"byte",
"[",
"]",
"toByteArray",
"(",
"Writable",
"...",
"writables",
")",
"{",
"final",
"DataOutputBuffer",
"out",
"=",
"new",
"DataOutputBuffer",
"(",
")",
";",
"try",
"{",
"for",
"(",
"Writable",
"w",
":",
"writables",
")",
"{",
"w... | Convert writables to a byte array | [
"Convert",
"writables",
"to",
"a",
"byte",
"array"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/io/WritableUtils.java#L404-L415 |
128,403 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/DeviceLocalNDArray.java | DeviceLocalNDArray.broadcast | public void broadcast(INDArray array) {
if (array == null)
return;
Nd4j.getExecutioner().commit();
val config = OpProfiler.getInstance().getConfig();
val locality = config.isCheckLocality();
if (locality)
config.setCheckLocality(false);
int num... | java | public void broadcast(INDArray array) {
if (array == null)
return;
Nd4j.getExecutioner().commit();
val config = OpProfiler.getInstance().getConfig();
val locality = config.isCheckLocality();
if (locality)
config.setCheckLocality(false);
int num... | [
"public",
"void",
"broadcast",
"(",
"INDArray",
"array",
")",
"{",
"if",
"(",
"array",
"==",
"null",
")",
"return",
";",
"Nd4j",
".",
"getExecutioner",
"(",
")",
".",
"commit",
"(",
")",
";",
"val",
"config",
"=",
"OpProfiler",
".",
"getInstance",
"(",... | This method duplicates array, and stores it to all devices
@param array | [
"This",
"method",
"duplicates",
"array",
"and",
"stores",
"it",
"to",
"all",
"devices"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/DeviceLocalNDArray.java#L49-L73 |
128,404 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/flow/impl/SynchronousFlowController.java | SynchronousFlowController.synchronizeToHost | @Override
public void synchronizeToHost(AllocationPoint point) {
if (!point.isActualOnHostSide()) {
CudaContext context = (CudaContext) allocator.getDeviceContext().getContext();
if (!point.isConstant())
waitTillFinished(point);
// log.info("Synchroniz... | java | @Override
public void synchronizeToHost(AllocationPoint point) {
if (!point.isActualOnHostSide()) {
CudaContext context = (CudaContext) allocator.getDeviceContext().getContext();
if (!point.isConstant())
waitTillFinished(point);
// log.info("Synchroniz... | [
"@",
"Override",
"public",
"void",
"synchronizeToHost",
"(",
"AllocationPoint",
"point",
")",
"{",
"if",
"(",
"!",
"point",
".",
"isActualOnHostSide",
"(",
")",
")",
"{",
"CudaContext",
"context",
"=",
"(",
"CudaContext",
")",
"allocator",
".",
"getDeviceConte... | This method makes sure HOST memory contains latest data from GPU
@param point | [
"This",
"method",
"makes",
"sure",
"HOST",
"memory",
"contains",
"latest",
"data",
"from",
"GPU"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/flow/impl/SynchronousFlowController.java#L68-L97 |
128,405 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/lossfunctions/impl/LossMixtureDensity.java | LossMixtureDensity.extractComponents | public MixtureDensityComponents extractComponents(INDArray output) {
long outputSize = output.size(1);
if (outputSize != (mLabelWidth + 2) * mMixtures) {
throw new IllegalArgumentException(
"Network output size " + outputSize + " must be (labels+2)*mixtures where ... | java | public MixtureDensityComponents extractComponents(INDArray output) {
long outputSize = output.size(1);
if (outputSize != (mLabelWidth + 2) * mMixtures) {
throw new IllegalArgumentException(
"Network output size " + outputSize + " must be (labels+2)*mixtures where ... | [
"public",
"MixtureDensityComponents",
"extractComponents",
"(",
"INDArray",
"output",
")",
"{",
"long",
"outputSize",
"=",
"output",
".",
"size",
"(",
"1",
")",
";",
"if",
"(",
"outputSize",
"!=",
"(",
"mLabelWidth",
"+",
"2",
")",
"*",
"mMixtures",
")",
"... | through Nd4j operations in order to increase performance. | [
"through",
"Nd4j",
"operations",
"in",
"order",
"to",
"increase",
"performance",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/lossfunctions/impl/LossMixtureDensity.java#L111-L156 |
128,406 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/lossfunctions/impl/LossMixtureDensity.java | LossMixtureDensity.computeScoreArray | @Override
public INDArray computeScoreArray(INDArray labels, INDArray preOutput, IActivation activationFn, INDArray mask) {
labels = labels.castTo(preOutput.dataType()); //No-op if already correct dtype
INDArray output = activationFn.getActivation(preOutput.dup(), false);
MixtureDensityCom... | java | @Override
public INDArray computeScoreArray(INDArray labels, INDArray preOutput, IActivation activationFn, INDArray mask) {
labels = labels.castTo(preOutput.dataType()); //No-op if already correct dtype
INDArray output = activationFn.getActivation(preOutput.dup(), false);
MixtureDensityCom... | [
"@",
"Override",
"public",
"INDArray",
"computeScoreArray",
"(",
"INDArray",
"labels",
",",
"INDArray",
"preOutput",
",",
"IActivation",
"activationFn",
",",
"INDArray",
"mask",
")",
"{",
"labels",
"=",
"labels",
".",
"castTo",
"(",
"preOutput",
".",
"dataType",... | This method returns the score for each of the given outputs against the
given set of labels. For a mixture density network, this is done by
extracting the "alpha", "mu", and "sigma" components of each gaussian
and computing the negative log likelihood that the labels fall within
a linear combination of these gaussian ... | [
"This",
"method",
"returns",
"the",
"score",
"for",
"each",
"of",
"the",
"given",
"outputs",
"against",
"the",
"given",
"set",
"of",
"labels",
".",
"For",
"a",
"mixture",
"density",
"network",
"this",
"is",
"done",
"by",
"extracting",
"the",
"alpha",
"mu",... | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/lossfunctions/impl/LossMixtureDensity.java#L203-L215 |
128,407 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPUtils.java | RPUtils.sortCandidates | public static List<Pair<Double,Integer>> sortCandidates(INDArray x,INDArray X,
List<Integer> candidates,
String similarityFunction) {
int prevIdx = -1;
List<Pair<Double,Integer>> ret =... | java | public static List<Pair<Double,Integer>> sortCandidates(INDArray x,INDArray X,
List<Integer> candidates,
String similarityFunction) {
int prevIdx = -1;
List<Pair<Double,Integer>> ret =... | [
"public",
"static",
"List",
"<",
"Pair",
"<",
"Double",
",",
"Integer",
">",
">",
"sortCandidates",
"(",
"INDArray",
"x",
",",
"INDArray",
"X",
",",
"List",
"<",
"Integer",
">",
"candidates",
",",
"String",
"similarityFunction",
")",
"{",
"int",
"prevIdx",... | Get the sorted distances given the
query vector, input data, given the list of possible search candidates
@param x the query vector
@param X the input data to use
@param candidates the possible search candidates
@param similarityFunction the similarity function to use
@return the sorted distances | [
"Get",
"the",
"sorted",
"distances",
"given",
"the",
"query",
"vector",
"input",
"data",
"given",
"the",
"list",
"of",
"possible",
"search",
"candidates"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPUtils.java#L197-L219 |
128,408 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPUtils.java | RPUtils.query | public static RPNode query(RPNode from,RPHyperPlanes planes,INDArray x,String similarityFunction) {
if(from.getLeft() == null && from.getRight() == null) {
return from;
}
INDArray hyperPlane = planes.getHyperPlaneAt(from.getDepth());
double dist = computeDistance(similarity... | java | public static RPNode query(RPNode from,RPHyperPlanes planes,INDArray x,String similarityFunction) {
if(from.getLeft() == null && from.getRight() == null) {
return from;
}
INDArray hyperPlane = planes.getHyperPlaneAt(from.getDepth());
double dist = computeDistance(similarity... | [
"public",
"static",
"RPNode",
"query",
"(",
"RPNode",
"from",
",",
"RPHyperPlanes",
"planes",
",",
"INDArray",
"x",
",",
"String",
"similarityFunction",
")",
"{",
"if",
"(",
"from",
".",
"getLeft",
"(",
")",
"==",
"null",
"&&",
"from",
".",
"getRight",
"... | Query the tree starting from the given node
using the given hyper plane and similarity function
@param from the node to start from
@param planes the hyper plane to query
@param x the input data
@param similarityFunction the similarity function to use
@return the leaf node representing the given query from a
search in t... | [
"Query",
"the",
"tree",
"starting",
"from",
"the",
"given",
"node",
"using",
"the",
"given",
"hyper",
"plane",
"and",
"similarity",
"function"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPUtils.java#L292-L307 |
128,409 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPUtils.java | RPUtils.buildTree | public static void buildTree(RPTree tree,
RPNode from,
RPHyperPlanes planes,
INDArray X,
int maxSize,
int depth,
String si... | java | public static void buildTree(RPTree tree,
RPNode from,
RPHyperPlanes planes,
INDArray X,
int maxSize,
int depth,
String si... | [
"public",
"static",
"void",
"buildTree",
"(",
"RPTree",
"tree",
",",
"RPNode",
"from",
",",
"RPHyperPlanes",
"planes",
",",
"INDArray",
"X",
",",
"int",
"maxSize",
",",
"int",
"depth",
",",
"String",
"similarityFunction",
")",
"{",
"if",
"(",
"from",
".",
... | Initialize the tree given the input parameters
@param tree the tree to initialize
@param from the starting node
@param planes the hyper planes to use (vector space for similarity)
@param X the input data
@param maxSize the max number of indices on a given leaf node
@param depth the current depth of the tree
@param simi... | [
"Initialize",
"the",
"tree",
"given",
"the",
"input",
"parameters"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPUtils.java#L381-L442 |
128,410 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPUtils.java | RPUtils.slimNode | public static void slimNode(RPNode node) {
if(node.getRight() != null && node.getLeft() != null) {
node.getIndices().clear();
}
} | java | public static void slimNode(RPNode node) {
if(node.getRight() != null && node.getLeft() != null) {
node.getIndices().clear();
}
} | [
"public",
"static",
"void",
"slimNode",
"(",
"RPNode",
"node",
")",
"{",
"if",
"(",
"node",
".",
"getRight",
"(",
")",
"!=",
"null",
"&&",
"node",
".",
"getLeft",
"(",
")",
"!=",
"null",
")",
"{",
"node",
".",
"getIndices",
"(",
")",
".",
"clear",
... | Prune indices from the given node
when it's a leaf
@param node the node to prune | [
"Prune",
"indices",
"from",
"the",
"given",
"node",
"when",
"it",
"s",
"a",
"leaf"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/nearestneighbor-core/src/main/java/org/deeplearning4j/clustering/randomprojection/RPUtils.java#L475-L480 |
128,411 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/TokenizerBase.java | TokenizerBase.createTokenList | private <T extends TokenBase> List<T> createTokenList(int offset, String text) {
ArrayList<T> result = new ArrayList<>();
ViterbiLattice lattice = viterbiBuilder.build(text);
List<ViterbiNode> bestPath = viterbiSearcher.search(lattice);
for (ViterbiNode node : bestPath) {
i... | java | private <T extends TokenBase> List<T> createTokenList(int offset, String text) {
ArrayList<T> result = new ArrayList<>();
ViterbiLattice lattice = viterbiBuilder.build(text);
List<ViterbiNode> bestPath = viterbiSearcher.search(lattice);
for (ViterbiNode node : bestPath) {
i... | [
"private",
"<",
"T",
"extends",
"TokenBase",
">",
"List",
"<",
"T",
">",
"createTokenList",
"(",
"int",
"offset",
",",
"String",
"text",
")",
"{",
"ArrayList",
"<",
"T",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"ViterbiLattice",
"la... | Tokenize input sentence.
@param offset offset of sentence in original input text
@param text sentence to tokenize
@return list of Token | [
"Tokenize",
"input",
"sentence",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/TokenizerBase.java#L208-L226 |
128,412 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/memory/provider/BasicWorkspaceManager.java | BasicWorkspaceManager.destroyWorkspace | @Override
public void destroyWorkspace(MemoryWorkspace workspace) {
if (workspace == null || workspace instanceof DummyWorkspace)
return;
//workspace.destroyWorkspace();
backingMap.get().remove(workspace.getId());
} | java | @Override
public void destroyWorkspace(MemoryWorkspace workspace) {
if (workspace == null || workspace instanceof DummyWorkspace)
return;
//workspace.destroyWorkspace();
backingMap.get().remove(workspace.getId());
} | [
"@",
"Override",
"public",
"void",
"destroyWorkspace",
"(",
"MemoryWorkspace",
"workspace",
")",
"{",
"if",
"(",
"workspace",
"==",
"null",
"||",
"workspace",
"instanceof",
"DummyWorkspace",
")",
"return",
";",
"//workspace.destroyWorkspace();",
"backingMap",
".",
"... | This method destroys given workspace
@param workspace | [
"This",
"method",
"destroys",
"given",
"workspace"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/memory/provider/BasicWorkspaceManager.java#L160-L167 |
128,413 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/memory/provider/BasicWorkspaceManager.java | BasicWorkspaceManager.destroyWorkspace | @Override
public void destroyWorkspace() {
ensureThreadExistense();
MemoryWorkspace workspace = backingMap.get().get(MemoryWorkspace.DEFAULT_ID);
//if (workspace != null)
//workspace.destroyWorkspace();
backingMap.get().remove(MemoryWorkspace.DEFAULT_ID);
} | java | @Override
public void destroyWorkspace() {
ensureThreadExistense();
MemoryWorkspace workspace = backingMap.get().get(MemoryWorkspace.DEFAULT_ID);
//if (workspace != null)
//workspace.destroyWorkspace();
backingMap.get().remove(MemoryWorkspace.DEFAULT_ID);
} | [
"@",
"Override",
"public",
"void",
"destroyWorkspace",
"(",
")",
"{",
"ensureThreadExistense",
"(",
")",
";",
"MemoryWorkspace",
"workspace",
"=",
"backingMap",
".",
"get",
"(",
")",
".",
"get",
"(",
"MemoryWorkspace",
".",
"DEFAULT_ID",
")",
";",
"//if (works... | This method destroy default workspace, if any | [
"This",
"method",
"destroy",
"default",
"workspace",
"if",
"any"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/memory/provider/BasicWorkspaceManager.java#L172-L181 |
128,414 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/memory/provider/BasicWorkspaceManager.java | BasicWorkspaceManager.destroyAllWorkspacesForCurrentThread | @Override
public void destroyAllWorkspacesForCurrentThread() {
ensureThreadExistense();
List<MemoryWorkspace> workspaces = new ArrayList<>();
workspaces.addAll(backingMap.get().values());
for (MemoryWorkspace workspace : workspaces) {
destroyWorkspace(workspace);
... | java | @Override
public void destroyAllWorkspacesForCurrentThread() {
ensureThreadExistense();
List<MemoryWorkspace> workspaces = new ArrayList<>();
workspaces.addAll(backingMap.get().values());
for (MemoryWorkspace workspace : workspaces) {
destroyWorkspace(workspace);
... | [
"@",
"Override",
"public",
"void",
"destroyAllWorkspacesForCurrentThread",
"(",
")",
"{",
"ensureThreadExistense",
"(",
")",
";",
"List",
"<",
"MemoryWorkspace",
">",
"workspaces",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"workspaces",
".",
"addAll",
"(",
... | This method destroys all workspaces allocated in current thread | [
"This",
"method",
"destroys",
"all",
"workspaces",
"allocated",
"in",
"current",
"thread"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/memory/provider/BasicWorkspaceManager.java#L186-L198 |
128,415 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/FeatureUtil.java | FeatureUtil.scaleByMax | public static void scaleByMax(INDArray toScale) {
INDArray scale = toScale.max(1);
for (int i = 0; i < toScale.rows(); i++) {
double scaleBy = scale.getDouble(i);
toScale.putRow(i, toScale.getRow(i).divi(scaleBy));
}
} | java | public static void scaleByMax(INDArray toScale) {
INDArray scale = toScale.max(1);
for (int i = 0; i < toScale.rows(); i++) {
double scaleBy = scale.getDouble(i);
toScale.putRow(i, toScale.getRow(i).divi(scaleBy));
}
} | [
"public",
"static",
"void",
"scaleByMax",
"(",
"INDArray",
"toScale",
")",
"{",
"INDArray",
"scale",
"=",
"toScale",
".",
"max",
"(",
"1",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"toScale",
".",
"rows",
"(",
")",
";",
"i",
"++"... | Divides each row by its max
@param toScale the matrix to divide by its row maxes | [
"Divides",
"each",
"row",
"by",
"its",
"max"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/FeatureUtil.java#L75-L81 |
128,416 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-zoo/src/main/java/org/deeplearning4j/zoo/util/imagenet/ImageNetLabels.java | ImageNetLabels.decodePredictions | public String decodePredictions(INDArray predictions) {
Preconditions.checkState(predictions.size(1) == predictionLabels.size(), "Invalid input array:" +
" expected array with size(1) equal to numLabels (%s), got array with shape %s", predictionLabels.size(), predictions.shape());
Strin... | java | public String decodePredictions(INDArray predictions) {
Preconditions.checkState(predictions.size(1) == predictionLabels.size(), "Invalid input array:" +
" expected array with size(1) equal to numLabels (%s), got array with shape %s", predictionLabels.size(), predictions.shape());
Strin... | [
"public",
"String",
"decodePredictions",
"(",
"INDArray",
"predictions",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"predictions",
".",
"size",
"(",
"1",
")",
"==",
"predictionLabels",
".",
"size",
"(",
")",
",",
"\"Invalid input array:\"",
"+",
"\" expe... | Given predictions from the trained model this method will return a string
listing the top five matches and the respective probabilities
@param predictions
@return | [
"Given",
"predictions",
"from",
"the",
"trained",
"model",
"this",
"method",
"will",
"return",
"a",
"string",
"listing",
"the",
"top",
"five",
"matches",
"and",
"the",
"respective",
"probabilities"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-zoo/src/main/java/org/deeplearning4j/zoo/util/imagenet/ImageNetLabels.java#L95-L122 |
128,417 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/NormalizerStandardize.java | NormalizerStandardize.load | public void load(File... files) throws IOException {
setFeatureStats(DistributionStats.load(files[0], files[1]));
if (isFitLabel()) {
setLabelStats(DistributionStats.load(files[2], files[3]));
}
} | java | public void load(File... files) throws IOException {
setFeatureStats(DistributionStats.load(files[0], files[1]));
if (isFitLabel()) {
setLabelStats(DistributionStats.load(files[2], files[3]));
}
} | [
"public",
"void",
"load",
"(",
"File",
"...",
"files",
")",
"throws",
"IOException",
"{",
"setFeatureStats",
"(",
"DistributionStats",
".",
"load",
"(",
"files",
"[",
"0",
"]",
",",
"files",
"[",
"1",
"]",
")",
")",
";",
"if",
"(",
"isFitLabel",
"(",
... | Load the means and standard deviations from the file system
@param files the files to load from. Needs 4 files if normalizing labels, otherwise 2. | [
"Load",
"the",
"means",
"and",
"standard",
"deviations",
"from",
"the",
"file",
"system"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/NormalizerStandardize.java#L81-L86 |
128,418 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-common/src/main/java/org/deeplearning4j/common/resources/DL4JResources.java | DL4JResources.getDirectory | public static File getDirectory(ResourceType resourceType, String resourceName){
File f = new File(baseDirectory, resourceType.resourceName());
f = new File(f, resourceName);
f.mkdirs();
return f;
} | java | public static File getDirectory(ResourceType resourceType, String resourceName){
File f = new File(baseDirectory, resourceType.resourceName());
f = new File(f, resourceName);
f.mkdirs();
return f;
} | [
"public",
"static",
"File",
"getDirectory",
"(",
"ResourceType",
"resourceType",
",",
"String",
"resourceName",
")",
"{",
"File",
"f",
"=",
"new",
"File",
"(",
"baseDirectory",
",",
"resourceType",
".",
"resourceName",
"(",
")",
")",
";",
"f",
"=",
"new",
... | Get the storage location for the specified resource type and resource name
@param resourceType Type of resource
@param resourceName Name of the resource
@return The root directory. Creates the directory and any parent directories, if required | [
"Get",
"the",
"storage",
"location",
"for",
"the",
"specified",
"resource",
"type",
"and",
"resource",
"name"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-common/src/main/java/org/deeplearning4j/common/resources/DL4JResources.java#L148-L153 |
128,419 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-parameterserver/src/main/java/org/deeplearning4j/spark/parameterserver/networking/v1/SilentTrainingDriver.java | SilentTrainingDriver.finishTraining | @Override
public void finishTraining(long originatorId, long taskId) {
// on Master thread we'll be applying final gradients
if (params != null && stepFunction != null) {
if (hasSomething.get()) {
stepFunction.step(params, updates);
//Nd4j.getMemoryManage... | java | @Override
public void finishTraining(long originatorId, long taskId) {
// on Master thread we'll be applying final gradients
if (params != null && stepFunction != null) {
if (hasSomething.get()) {
stepFunction.step(params, updates);
//Nd4j.getMemoryManage... | [
"@",
"Override",
"public",
"void",
"finishTraining",
"(",
"long",
"originatorId",
",",
"long",
"taskId",
")",
"{",
"// on Master thread we'll be applying final gradients",
"if",
"(",
"params",
"!=",
"null",
"&&",
"stepFunction",
"!=",
"null",
")",
"{",
"if",
"(",
... | This method is used on Master only, applies buffered updates to params
@param originatorId
@param taskId | [
"This",
"method",
"is",
"used",
"on",
"Master",
"only",
"applies",
"buffered",
"updates",
"to",
"params"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-parameterserver/src/main/java/org/deeplearning4j/spark/parameterserver/networking/v1/SilentTrainingDriver.java#L218-L230 |
128,420 | deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/NativeImageLoader.java | NativeImageLoader.streamToMat | private Mat streamToMat(InputStream is) throws IOException {
if(buffer == null){
buffer = IOUtils.toByteArray(is);
bufferMat = new Mat(buffer);
return bufferMat;
} else {
int numReadTotal = is.read(buffer);
//Need to know if all data has been r... | java | private Mat streamToMat(InputStream is) throws IOException {
if(buffer == null){
buffer = IOUtils.toByteArray(is);
bufferMat = new Mat(buffer);
return bufferMat;
} else {
int numReadTotal = is.read(buffer);
//Need to know if all data has been r... | [
"private",
"Mat",
"streamToMat",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"if",
"(",
"buffer",
"==",
"null",
")",
"{",
"buffer",
"=",
"IOUtils",
".",
"toByteArray",
"(",
"is",
")",
";",
"bufferMat",
"=",
"new",
"Mat",
"(",
"buffer",
... | Read the stream to the buffer, and return the number of bytes read
@param is Input stream to read
@return Mat with the buffer data as a row vector
@throws IOException | [
"Read",
"the",
"stream",
"to",
"the",
"buffer",
"and",
"return",
"the",
"number",
"of",
"bytes",
"read"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/NativeImageLoader.java#L269-L309 |
128,421 | deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/NativeImageLoader.java | NativeImageLoader.asWritable | public ImageWritable asWritable(File f) throws IOException {
try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(f))) {
Mat mat = streamToMat(bis);
Mat image = imdecode(mat, IMREAD_ANYDEPTH | IMREAD_ANYCOLOR);
if (image == null || image.empty()) {
... | java | public ImageWritable asWritable(File f) throws IOException {
try (BufferedInputStream bis = new BufferedInputStream(new FileInputStream(f))) {
Mat mat = streamToMat(bis);
Mat image = imdecode(mat, IMREAD_ANYDEPTH | IMREAD_ANYCOLOR);
if (image == null || image.empty()) {
... | [
"public",
"ImageWritable",
"asWritable",
"(",
"File",
"f",
")",
"throws",
"IOException",
"{",
"try",
"(",
"BufferedInputStream",
"bis",
"=",
"new",
"BufferedInputStream",
"(",
"new",
"FileInputStream",
"(",
"f",
")",
")",
")",
"{",
"Mat",
"mat",
"=",
"stream... | Convert a file to a INDArray
@param f the image to convert
@return INDArray
@throws IOException | [
"Convert",
"a",
"file",
"to",
"a",
"INDArray"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/NativeImageLoader.java#L685-L701 |
128,422 | deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/NativeImageLoader.java | NativeImageLoader.asMatrix | public INDArray asMatrix(ImageWritable writable) throws IOException {
Mat image = converter.convert(writable.getFrame());
return asMatrix(image);
} | java | public INDArray asMatrix(ImageWritable writable) throws IOException {
Mat image = converter.convert(writable.getFrame());
return asMatrix(image);
} | [
"public",
"INDArray",
"asMatrix",
"(",
"ImageWritable",
"writable",
")",
"throws",
"IOException",
"{",
"Mat",
"image",
"=",
"converter",
".",
"convert",
"(",
"writable",
".",
"getFrame",
"(",
")",
")",
";",
"return",
"asMatrix",
"(",
"image",
")",
";",
"}"... | Convert ImageWritable to INDArray
@param writable ImageWritable to convert
@return INDArray
@throws IOException | [
"Convert",
"ImageWritable",
"to",
"INDArray"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/NativeImageLoader.java#L710-L713 |
128,423 | deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/NativeImageLoader.java | NativeImageLoader.asFrame | public Frame asFrame(INDArray array, int dataType) {
return converter.convert(asMat(array, OpenCVFrameConverter.getMatDepth(dataType)));
} | java | public Frame asFrame(INDArray array, int dataType) {
return converter.convert(asMat(array, OpenCVFrameConverter.getMatDepth(dataType)));
} | [
"public",
"Frame",
"asFrame",
"(",
"INDArray",
"array",
",",
"int",
"dataType",
")",
"{",
"return",
"converter",
".",
"convert",
"(",
"asMat",
"(",
"array",
",",
"OpenCVFrameConverter",
".",
"getMatDepth",
"(",
"dataType",
")",
")",
")",
";",
"}"
] | Converts an INDArray to a JavaCV Frame. Only intended for images with rank 3.
@param array to convert
@param dataType from JavaCV (DEPTH_FLOAT, DEPTH_UBYTE, etc), or -1 to use same type as the INDArray
@return data copied to a Frame | [
"Converts",
"an",
"INDArray",
"to",
"a",
"JavaCV",
"Frame",
".",
"Only",
"intended",
"for",
"images",
"with",
"rank",
"3",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/NativeImageLoader.java#L727-L729 |
128,424 | deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/NativeImageLoader.java | NativeImageLoader.asMatrix | private INDArray asMatrix(BytePointer bytes, long length) throws IOException {
PIXA pixa;
pixa = pixaReadMemMultipageTiff(bytes, length);
INDArray data;
INDArray currentD;
INDArrayIndex[] index = null;
switch (this.multiPageMode) {
case MINIBATCH:
... | java | private INDArray asMatrix(BytePointer bytes, long length) throws IOException {
PIXA pixa;
pixa = pixaReadMemMultipageTiff(bytes, length);
INDArray data;
INDArray currentD;
INDArrayIndex[] index = null;
switch (this.multiPageMode) {
case MINIBATCH:
... | [
"private",
"INDArray",
"asMatrix",
"(",
"BytePointer",
"bytes",
",",
"long",
"length",
")",
"throws",
"IOException",
"{",
"PIXA",
"pixa",
";",
"pixa",
"=",
"pixaReadMemMultipageTiff",
"(",
"bytes",
",",
"length",
")",
";",
"INDArray",
"data",
";",
"INDArray",
... | Read multipage tiff and load into INDArray
@param bytes
@return INDArray
@throws IOException | [
"Read",
"multipage",
"tiff",
"and",
"load",
"into",
"INDArray"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/loader/NativeImageLoader.java#L819-L860 |
128,425 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/layers/BaseLayer.java | BaseLayer.resetLayerDefaultConfig | public void resetLayerDefaultConfig() {
//clear the learning related params for all layers in the origConf and set to defaults
this.setIUpdater(null);
this.setWeightInitFn(null);
this.setBiasInit(Double.NaN);
this.setGainInit(Double.NaN);
this.regularization = null;
... | java | public void resetLayerDefaultConfig() {
//clear the learning related params for all layers in the origConf and set to defaults
this.setIUpdater(null);
this.setWeightInitFn(null);
this.setBiasInit(Double.NaN);
this.setGainInit(Double.NaN);
this.regularization = null;
... | [
"public",
"void",
"resetLayerDefaultConfig",
"(",
")",
"{",
"//clear the learning related params for all layers in the origConf and set to defaults",
"this",
".",
"setIUpdater",
"(",
"null",
")",
";",
"this",
".",
"setWeightInitFn",
"(",
"null",
")",
";",
"this",
".",
"... | Reset the learning related configs of the layer to default. When instantiated with a global neural network
configuration the parameters specified in the neural network configuration will be used. For internal use with
the transfer learning API. Users should not have to call this method directly. | [
"Reset",
"the",
"learning",
"related",
"configs",
"of",
"the",
"layer",
"to",
"default",
".",
"When",
"instantiated",
"with",
"a",
"global",
"neural",
"network",
"configuration",
"the",
"parameters",
"specified",
"in",
"the",
"neural",
"network",
"configuration",
... | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/layers/BaseLayer.java#L82-L94 |
128,426 | deeplearning4j/deeplearning4j | datavec/datavec-python/src/main/java/org/datavec/python/PythonExecutioner.java | PythonExecutioner.exec | public static void exec(String code){
code = getFunctionalCode("__f_" + Thread.currentThread().getId(), code);
acquireGIL();
log.info("CPython: PyRun_SimpleStringFlag()");
log.info(code);
int result = PyRun_SimpleStringFlags(code, null);
if (result != 0){
PyE... | java | public static void exec(String code){
code = getFunctionalCode("__f_" + Thread.currentThread().getId(), code);
acquireGIL();
log.info("CPython: PyRun_SimpleStringFlag()");
log.info(code);
int result = PyRun_SimpleStringFlags(code, null);
if (result != 0){
PyE... | [
"public",
"static",
"void",
"exec",
"(",
"String",
"code",
")",
"{",
"code",
"=",
"getFunctionalCode",
"(",
"\"__f_\"",
"+",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getId",
"(",
")",
",",
"code",
")",
";",
"acquireGIL",
"(",
")",
";",
"log",
... | Executes python code. Also manages python thread state.
@param code | [
"Executes",
"python",
"code",
".",
"Also",
"manages",
"python",
"thread",
"state",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-python/src/main/java/org/datavec/python/PythonExecutioner.java#L241-L254 |
128,427 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/LinAlgExceptions.java | LinAlgExceptions.assertSameLength | public static void assertSameLength(INDArray x, INDArray z) {
val lengthX = x.length();
val lengthZ = z.length();
if (lengthX != lengthZ && lengthX != 1 && lengthZ != 1)
throw new IllegalStateException("Mis matched lengths: [" + x.length() + "] != [" + z.length() + "] - " +
... | java | public static void assertSameLength(INDArray x, INDArray z) {
val lengthX = x.length();
val lengthZ = z.length();
if (lengthX != lengthZ && lengthX != 1 && lengthZ != 1)
throw new IllegalStateException("Mis matched lengths: [" + x.length() + "] != [" + z.length() + "] - " +
... | [
"public",
"static",
"void",
"assertSameLength",
"(",
"INDArray",
"x",
",",
"INDArray",
"z",
")",
"{",
"val",
"lengthX",
"=",
"x",
".",
"length",
"(",
")",
";",
"val",
"lengthZ",
"=",
"z",
".",
"length",
"(",
")",
";",
"if",
"(",
"lengthX",
"!=",
"l... | Asserts both arrays be the same length
@param x
@param z | [
"Asserts",
"both",
"arrays",
"be",
"the",
"same",
"length"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/LinAlgExceptions.java#L37-L43 |
128,428 | deeplearning4j/deeplearning4j | nd4j/nd4j-tensorflow/src/main/java/org/nd4j/tensorflow/conversion/TensorflowConversion.java | TensorflowConversion.loadSavedModel | public TF_Session loadSavedModel(SavedModelConfig savedModelConfig, TF_SessionOptions options, TF_Buffer runOptions, TF_Graph graph, Map<String, String> inputsMap, Map<String, String> outputsMap, TF_Status status) {
TF_Buffer metaGraph = TF_Buffer.newBuffer();
TF_Session session = TF_LoadSessionFromSave... | java | public TF_Session loadSavedModel(SavedModelConfig savedModelConfig, TF_SessionOptions options, TF_Buffer runOptions, TF_Graph graph, Map<String, String> inputsMap, Map<String, String> outputsMap, TF_Status status) {
TF_Buffer metaGraph = TF_Buffer.newBuffer();
TF_Session session = TF_LoadSessionFromSave... | [
"public",
"TF_Session",
"loadSavedModel",
"(",
"SavedModelConfig",
"savedModelConfig",
",",
"TF_SessionOptions",
"options",
",",
"TF_Buffer",
"runOptions",
",",
"TF_Graph",
"graph",
",",
"Map",
"<",
"String",
",",
"String",
">",
"inputsMap",
",",
"Map",
"<",
"Stri... | Load a session based on the saved model
@param savedModelConfig the configuration for the saved model
@param options the session options to use
@param runOptions the run configuration to use
@param graph the tf graph to use
@param inputsMap the input map
@param outputsMap the output names
@param status the status obje... | [
"Load",
"a",
"session",
"based",
"on",
"the",
"saved",
"model"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-tensorflow/src/main/java/org/nd4j/tensorflow/conversion/TensorflowConversion.java#L357-L385 |
128,429 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/recurrent/FwdPassReturn.java | FwdPassReturn.leverageTo | public void leverageTo(String id) {
if (fwdPassOutput != null)
fwdPassOutput = fwdPassOutput.leverageTo(id);
if (fwdPassOutputAsArrays != null)
for (int i = 0; i < fwdPassOutputAsArrays.length; i++)
fwdPassOutputAsArrays[i] = fwdPassOutputAsArrays[i].leverageTo(... | java | public void leverageTo(String id) {
if (fwdPassOutput != null)
fwdPassOutput = fwdPassOutput.leverageTo(id);
if (fwdPassOutputAsArrays != null)
for (int i = 0; i < fwdPassOutputAsArrays.length; i++)
fwdPassOutputAsArrays[i] = fwdPassOutputAsArrays[i].leverageTo(... | [
"public",
"void",
"leverageTo",
"(",
"String",
"id",
")",
"{",
"if",
"(",
"fwdPassOutput",
"!=",
"null",
")",
"fwdPassOutput",
"=",
"fwdPassOutput",
".",
"leverageTo",
"(",
"id",
")",
";",
"if",
"(",
"fwdPassOutputAsArrays",
"!=",
"null",
")",
"for",
"(",
... | This method is OPTIONAL, and written mostly for future use
@param id | [
"This",
"method",
"is",
"OPTIONAL",
"and",
"written",
"mostly",
"for",
"future",
"use"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/recurrent/FwdPassReturn.java#L54-L115 |
128,430 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/viterbi/ViterbiSearcher.java | ViterbiSearcher.search | public List<ViterbiNode> search(ViterbiLattice lattice) {
ViterbiNode[][] endIndexArr = calculatePathCosts(lattice);
LinkedList<ViterbiNode> result = backtrackBestPath(endIndexArr[0][0]);
return result;
} | java | public List<ViterbiNode> search(ViterbiLattice lattice) {
ViterbiNode[][] endIndexArr = calculatePathCosts(lattice);
LinkedList<ViterbiNode> result = backtrackBestPath(endIndexArr[0][0]);
return result;
} | [
"public",
"List",
"<",
"ViterbiNode",
">",
"search",
"(",
"ViterbiLattice",
"lattice",
")",
"{",
"ViterbiNode",
"[",
"]",
"[",
"]",
"endIndexArr",
"=",
"calculatePathCosts",
"(",
"lattice",
")",
";",
"LinkedList",
"<",
"ViterbiNode",
">",
"result",
"=",
"bac... | Find best path from input lattice.
@param lattice the result of build method
@return List of ViterbiNode which consist best path | [
"Find",
"best",
"path",
"from",
"input",
"lattice",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp-japanese/src/main/java/com/atilika/kuromoji/viterbi/ViterbiSearcher.java#L60-L66 |
128,431 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-nlp-java8/src/main/java/org/deeplearning4j/spark/models/sequencevectors/SparkSequenceVectors.java | SparkSequenceVectors.buildShallowVocabCache | protected VocabCache<ShallowSequenceElement> buildShallowVocabCache(Counter<Long> counter) {
// TODO: need simplified cache here, that will operate on Long instead of string labels
VocabCache<ShallowSequenceElement> vocabCache = new AbstractCache<>();
for (Long id : counter.keySet()) {
... | java | protected VocabCache<ShallowSequenceElement> buildShallowVocabCache(Counter<Long> counter) {
// TODO: need simplified cache here, that will operate on Long instead of string labels
VocabCache<ShallowSequenceElement> vocabCache = new AbstractCache<>();
for (Long id : counter.keySet()) {
... | [
"protected",
"VocabCache",
"<",
"ShallowSequenceElement",
">",
"buildShallowVocabCache",
"(",
"Counter",
"<",
"Long",
">",
"counter",
")",
"{",
"// TODO: need simplified cache here, that will operate on Long instead of string labels",
"VocabCache",
"<",
"ShallowSequenceElement",
... | This method builds shadow vocabulary and huffman tree
@param counter
@return | [
"This",
"method",
"builds",
"shadow",
"vocabulary",
"and",
"huffman",
"tree"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark-nlp-java8/src/main/java/org/deeplearning4j/spark/models/sequencevectors/SparkSequenceVectors.java#L351-L366 |
128,432 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java | SDVariable.storeAndAllocateNewArray | public INDArray storeAndAllocateNewArray() {
Preconditions.checkState(variableType == VariableType.VARIABLE, "Unable to allocate and store array for variable of type %s: only" +
" VARIABLE type variables can be initialized using this method", variableType);
if(!sameDiff.arrayAlreadyExis... | java | public INDArray storeAndAllocateNewArray() {
Preconditions.checkState(variableType == VariableType.VARIABLE, "Unable to allocate and store array for variable of type %s: only" +
" VARIABLE type variables can be initialized using this method", variableType);
if(!sameDiff.arrayAlreadyExis... | [
"public",
"INDArray",
"storeAndAllocateNewArray",
"(",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"variableType",
"==",
"VariableType",
".",
"VARIABLE",
",",
"\"Unable to allocate and store array for variable of type %s: only\"",
"+",
"\" VARIABLE type variables can be in... | Allocate and return a new array
based on the vertex id and weight initialization.
@return the allocated array | [
"Allocate",
"and",
"return",
"a",
"new",
"array",
"based",
"on",
"the",
"vertex",
"id",
"and",
"weight",
"initialization",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java#L158-L175 |
128,433 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java | SDVariable.getShape | public long[] getShape() {
if (variableType == VariableType.PLACEHOLDER && getArr() == null) {
if (shape != null)
return shape;
else
return new long[0];
}
long[] initialShape = sameDiff.getShapeForVarName(getVarName());
if(initial... | java | public long[] getShape() {
if (variableType == VariableType.PLACEHOLDER && getArr() == null) {
if (shape != null)
return shape;
else
return new long[0];
}
long[] initialShape = sameDiff.getShapeForVarName(getVarName());
if(initial... | [
"public",
"long",
"[",
"]",
"getShape",
"(",
")",
"{",
"if",
"(",
"variableType",
"==",
"VariableType",
".",
"PLACEHOLDER",
"&&",
"getArr",
"(",
")",
"==",
"null",
")",
"{",
"if",
"(",
"shape",
"!=",
"null",
")",
"return",
"shape",
";",
"else",
"retu... | Returns the shape of this variable
@return Shape of the variable | [
"Returns",
"the",
"shape",
"of",
"this",
"variable"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SDVariable.java#L281-L297 |
128,434 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/deeplearning4j-nearestneighbors-client/src/main/java/org/deeplearning4j/nearestneighbor/client/NearestNeighborsClient.java | NearestNeighborsClient.knnNew | public NearestNeighborsResults knnNew(int k, INDArray arr) throws Exception {
Base64NDArrayBody base64NDArrayBody =
Base64NDArrayBody.builder().k(k).ndarray(Nd4jBase64.base64String(arr)).build();
HttpRequestWithBody req = Unirest.post(url + "/knnnew");
req.header("accept... | java | public NearestNeighborsResults knnNew(int k, INDArray arr) throws Exception {
Base64NDArrayBody base64NDArrayBody =
Base64NDArrayBody.builder().k(k).ndarray(Nd4jBase64.base64String(arr)).build();
HttpRequestWithBody req = Unirest.post(url + "/knnnew");
req.header("accept... | [
"public",
"NearestNeighborsResults",
"knnNew",
"(",
"int",
"k",
",",
"INDArray",
"arr",
")",
"throws",
"Exception",
"{",
"Base64NDArrayBody",
"base64NDArrayBody",
"=",
"Base64NDArrayBody",
".",
"builder",
"(",
")",
".",
"k",
"(",
"k",
")",
".",
"ndarray",
"(",... | Run a k nearest neighbors search
on a NEW data point
@param k the number of results
to retrieve
@param arr the array to run the search on.
Note that this must be a row vector
@return
@throws Exception | [
"Run",
"a",
"k",
"nearest",
"neighbors",
"search",
"on",
"a",
"NEW",
"data",
"point"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/deeplearning4j-nearestneighbors-client/src/main/java/org/deeplearning4j/nearestneighbor/client/NearestNeighborsClient.java#L111-L123 |
128,435 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nearestneighbors-parent/deeplearning4j-nearestneighbors-client/src/main/java/org/deeplearning4j/nearestneighbor/client/NearestNeighborsClient.java | NearestNeighborsClient.addAuthHeader | protected HttpRequest addAuthHeader(HttpRequest request) {
if (authToken != null) {
request.header("authorization", "Bearer " + authToken);
}
return request;
} | java | protected HttpRequest addAuthHeader(HttpRequest request) {
if (authToken != null) {
request.header("authorization", "Bearer " + authToken);
}
return request;
} | [
"protected",
"HttpRequest",
"addAuthHeader",
"(",
"HttpRequest",
"request",
")",
"{",
"if",
"(",
"authToken",
"!=",
"null",
")",
"{",
"request",
".",
"header",
"(",
"\"authorization\"",
",",
"\"Bearer \"",
"+",
"authToken",
")",
";",
"}",
"return",
"request",
... | Add the specified authentication header to the specified HttpRequest
@param request HTTP Request to add the authentication header to | [
"Add",
"the",
"specified",
"authentication",
"header",
"to",
"the",
"specified",
"HttpRequest"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nearestneighbors-parent/deeplearning4j-nearestneighbors-client/src/main/java/org/deeplearning4j/nearestneighbor/client/NearestNeighborsClient.java#L131-L137 |
128,436 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java | DifferentialFunctionFactory.localResponseNormalization | public SDVariable localResponseNormalization(SDVariable input, LocalResponseNormalizationConfig lrnConfig) {
LocalResponseNormalization lrn = LocalResponseNormalization.builder()
.inputFunctions(new SDVariable[]{input})
.sameDiff(sameDiff())
.config(lrnConfig)
... | java | public SDVariable localResponseNormalization(SDVariable input, LocalResponseNormalizationConfig lrnConfig) {
LocalResponseNormalization lrn = LocalResponseNormalization.builder()
.inputFunctions(new SDVariable[]{input})
.sameDiff(sameDiff())
.config(lrnConfig)
... | [
"public",
"SDVariable",
"localResponseNormalization",
"(",
"SDVariable",
"input",
",",
"LocalResponseNormalizationConfig",
"lrnConfig",
")",
"{",
"LocalResponseNormalization",
"lrn",
"=",
"LocalResponseNormalization",
".",
"builder",
"(",
")",
".",
"inputFunctions",
"(",
... | Local response normalization operation.
@param input the inputs to lrn
@param lrnConfig the configuration
@return | [
"Local",
"response",
"normalization",
"operation",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java#L256-L264 |
128,437 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java | DifferentialFunctionFactory.conv1d | public SDVariable conv1d(SDVariable input, SDVariable weights, Conv1DConfig conv1DConfig) {
Conv1D conv1D = Conv1D.builder()
.inputFunctions(new SDVariable[]{input, weights})
.sameDiff(sameDiff())
.config(conv1DConfig)
.build();
return con... | java | public SDVariable conv1d(SDVariable input, SDVariable weights, Conv1DConfig conv1DConfig) {
Conv1D conv1D = Conv1D.builder()
.inputFunctions(new SDVariable[]{input, weights})
.sameDiff(sameDiff())
.config(conv1DConfig)
.build();
return con... | [
"public",
"SDVariable",
"conv1d",
"(",
"SDVariable",
"input",
",",
"SDVariable",
"weights",
",",
"Conv1DConfig",
"conv1DConfig",
")",
"{",
"Conv1D",
"conv1D",
"=",
"Conv1D",
".",
"builder",
"(",
")",
".",
"inputFunctions",
"(",
"new",
"SDVariable",
"[",
"]",
... | Conv1d operation.
@param input the inputs to conv1d
@param weights conv1d weights
@param conv1DConfig the configuration
@return | [
"Conv1d",
"operation",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java#L274-L282 |
128,438 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java | DifferentialFunctionFactory.avgPooling2d | public SDVariable avgPooling2d(SDVariable input, Pooling2DConfig pooling2DConfig) {
AvgPooling2D avgPooling2D = AvgPooling2D.builder()
.input(input)
.sameDiff(sameDiff())
.config(pooling2DConfig)
.build();
return avgPooling2D.outputVariabl... | java | public SDVariable avgPooling2d(SDVariable input, Pooling2DConfig pooling2DConfig) {
AvgPooling2D avgPooling2D = AvgPooling2D.builder()
.input(input)
.sameDiff(sameDiff())
.config(pooling2DConfig)
.build();
return avgPooling2D.outputVariabl... | [
"public",
"SDVariable",
"avgPooling2d",
"(",
"SDVariable",
"input",
",",
"Pooling2DConfig",
"pooling2DConfig",
")",
"{",
"AvgPooling2D",
"avgPooling2D",
"=",
"AvgPooling2D",
".",
"builder",
"(",
")",
".",
"input",
"(",
"input",
")",
".",
"sameDiff",
"(",
"sameDi... | Average pooling 2d operation.
@param input the inputs to pooling
@param pooling2DConfig the configuration
@return | [
"Average",
"pooling",
"2d",
"operation",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java#L317-L325 |
128,439 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java | DifferentialFunctionFactory.maxPooling2d | public SDVariable maxPooling2d(SDVariable input, Pooling2DConfig pooling2DConfig) {
MaxPooling2D maxPooling2D = MaxPooling2D.builder()
.input(input)
.sameDiff(sameDiff())
.config(pooling2DConfig)
.build();
return maxPooling2D.outputVariabl... | java | public SDVariable maxPooling2d(SDVariable input, Pooling2DConfig pooling2DConfig) {
MaxPooling2D maxPooling2D = MaxPooling2D.builder()
.input(input)
.sameDiff(sameDiff())
.config(pooling2DConfig)
.build();
return maxPooling2D.outputVariabl... | [
"public",
"SDVariable",
"maxPooling2d",
"(",
"SDVariable",
"input",
",",
"Pooling2DConfig",
"pooling2DConfig",
")",
"{",
"MaxPooling2D",
"maxPooling2D",
"=",
"MaxPooling2D",
".",
"builder",
"(",
")",
".",
"input",
"(",
"input",
")",
".",
"sameDiff",
"(",
"sameDi... | Max pooling 2d operation.
@param input the inputs to pooling
@param pooling2DConfig the configuration
@return | [
"Max",
"pooling",
"2d",
"operation",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java#L334-L342 |
128,440 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java | DifferentialFunctionFactory.avgPooling3d | public SDVariable avgPooling3d(SDVariable input, Pooling3DConfig pooling3DConfig) {
pooling3DConfig.setType(Pooling3D.Pooling3DType.AVG);
return pooling3d(input, pooling3DConfig);
} | java | public SDVariable avgPooling3d(SDVariable input, Pooling3DConfig pooling3DConfig) {
pooling3DConfig.setType(Pooling3D.Pooling3DType.AVG);
return pooling3d(input, pooling3DConfig);
} | [
"public",
"SDVariable",
"avgPooling3d",
"(",
"SDVariable",
"input",
",",
"Pooling3DConfig",
"pooling3DConfig",
")",
"{",
"pooling3DConfig",
".",
"setType",
"(",
"Pooling3D",
".",
"Pooling3DType",
".",
"AVG",
")",
";",
"return",
"pooling3d",
"(",
"input",
",",
"p... | Avg pooling 3d operation.
@param input the inputs to pooling
@param pooling3DConfig the configuration
@return | [
"Avg",
"pooling",
"3d",
"operation",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java#L351-L354 |
128,441 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java | DifferentialFunctionFactory.maxPooling3d | public SDVariable maxPooling3d(SDVariable input, Pooling3DConfig pooling3DConfig) {
pooling3DConfig.setType(Pooling3D.Pooling3DType.MAX);
return pooling3d(input, pooling3DConfig);
} | java | public SDVariable maxPooling3d(SDVariable input, Pooling3DConfig pooling3DConfig) {
pooling3DConfig.setType(Pooling3D.Pooling3DType.MAX);
return pooling3d(input, pooling3DConfig);
} | [
"public",
"SDVariable",
"maxPooling3d",
"(",
"SDVariable",
"input",
",",
"Pooling3DConfig",
"pooling3DConfig",
")",
"{",
"pooling3DConfig",
".",
"setType",
"(",
"Pooling3D",
".",
"Pooling3DType",
".",
"MAX",
")",
";",
"return",
"pooling3d",
"(",
"input",
",",
"p... | Max pooling 3d operation.
@param input the inputs to pooling
@param pooling3DConfig the configuration
@return | [
"Max",
"pooling",
"3d",
"operation",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java#L364-L367 |
128,442 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java | DifferentialFunctionFactory.conv3d | public SDVariable conv3d(SDVariable[] inputs, Conv3DConfig conv3DConfig) {
Conv3D conv3D = Conv3D.builder()
.inputFunctions(inputs)
.conv3DConfig(conv3DConfig)
.sameDiff(sameDiff())
.build();
val outputVars = conv3D.outputVariables();
... | java | public SDVariable conv3d(SDVariable[] inputs, Conv3DConfig conv3DConfig) {
Conv3D conv3D = Conv3D.builder()
.inputFunctions(inputs)
.conv3DConfig(conv3DConfig)
.sameDiff(sameDiff())
.build();
val outputVars = conv3D.outputVariables();
... | [
"public",
"SDVariable",
"conv3d",
"(",
"SDVariable",
"[",
"]",
"inputs",
",",
"Conv3DConfig",
"conv3DConfig",
")",
"{",
"Conv3D",
"conv3D",
"=",
"Conv3D",
".",
"builder",
"(",
")",
".",
"inputFunctions",
"(",
"inputs",
")",
".",
"conv3DConfig",
"(",
"conv3DC... | Conv3d operation.
@param inputs the inputs to conv3d
@param conv3DConfig the configuration
@return | [
"Conv3d",
"operation",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java#L451-L460 |
128,443 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java | DifferentialFunctionFactory.matchCondition | public SDVariable matchCondition(SDVariable in, Condition condition) {
return new MatchConditionTransform(sameDiff(), in, condition).outputVariable();
} | java | public SDVariable matchCondition(SDVariable in, Condition condition) {
return new MatchConditionTransform(sameDiff(), in, condition).outputVariable();
} | [
"public",
"SDVariable",
"matchCondition",
"(",
"SDVariable",
"in",
",",
"Condition",
"condition",
")",
"{",
"return",
"new",
"MatchConditionTransform",
"(",
"sameDiff",
"(",
")",
",",
"in",
",",
"condition",
")",
".",
"outputVariable",
"(",
")",
";",
"}"
] | Returns a boolean mask of equal shape to the input, where the condition is satisfied
@param in Input
@param condition Condition
@return Boolean mask | [
"Returns",
"a",
"boolean",
"mask",
"of",
"equal",
"shape",
"to",
"the",
"input",
"where",
"the",
"condition",
"is",
"satisfied"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/functions/DifferentialFunctionFactory.java#L723-L725 |
128,444 | deeplearning4j/deeplearning4j | datavec/datavec-spark-inference-parent/datavec-spark-inference-model/src/main/java/org/datavec/spark/transform/model/SingleCSVRecord.java | SingleCSVRecord.fromRow | public static SingleCSVRecord fromRow(DataSet row) {
if (!row.getFeatures().isVector() && !row.getFeatures().isScalar())
throw new IllegalArgumentException("Passed in dataset must represent a scalar or vector");
if (!row.getLabels().isVector() && !row.getLabels().isScalar())
thro... | java | public static SingleCSVRecord fromRow(DataSet row) {
if (!row.getFeatures().isVector() && !row.getFeatures().isScalar())
throw new IllegalArgumentException("Passed in dataset must represent a scalar or vector");
if (!row.getLabels().isVector() && !row.getLabels().isScalar())
thro... | [
"public",
"static",
"SingleCSVRecord",
"fromRow",
"(",
"DataSet",
"row",
")",
"{",
"if",
"(",
"!",
"row",
".",
"getFeatures",
"(",
")",
".",
"isVector",
"(",
")",
"&&",
"!",
"row",
".",
"getFeatures",
"(",
")",
".",
"isScalar",
"(",
")",
")",
"throw"... | Instantiate a csv record from a vector
given either an input dataset and a
one hot matrix, the index will be appended to
the end of the record, or for regression
it will append all values in the labels
@param row the input vectors
@return the record from this {@link DataSet} | [
"Instantiate",
"a",
"csv",
"record",
"from",
"a",
"vector",
"given",
"either",
"an",
"input",
"dataset",
"and",
"a",
"one",
"hot",
"matrix",
"the",
"index",
"will",
"be",
"appended",
"to",
"the",
"end",
"of",
"the",
"record",
"or",
"for",
"regression",
"... | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark-inference-parent/datavec-spark-inference-model/src/main/java/org/datavec/spark/transform/model/SingleCSVRecord.java#L54-L92 |
128,445 | deeplearning4j/deeplearning4j | arbiter/arbiter-core/src/main/java/org/deeplearning4j/arbiter/util/ClassPathResource.java | ClassPathResource.getUrl | private URL getUrl() {
ClassLoader loader = null;
try {
loader = Thread.currentThread().getContextClassLoader();
} catch (Exception e) {
// do nothing
}
if (loader == null) {
loader = ClassPathResource.class.getClassLoader();
}
... | java | private URL getUrl() {
ClassLoader loader = null;
try {
loader = Thread.currentThread().getContextClassLoader();
} catch (Exception e) {
// do nothing
}
if (loader == null) {
loader = ClassPathResource.class.getClassLoader();
}
... | [
"private",
"URL",
"getUrl",
"(",
")",
"{",
"ClassLoader",
"loader",
"=",
"null",
";",
"try",
"{",
"loader",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// d... | Returns URL of the requested resource
@return URL of the resource, if it's available in current Jar | [
"Returns",
"URL",
"of",
"the",
"requested",
"resource"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/arbiter/arbiter-core/src/main/java/org/deeplearning4j/arbiter/util/ClassPathResource.java#L59-L89 |
128,446 | deeplearning4j/deeplearning4j | arbiter/arbiter-core/src/main/java/org/deeplearning4j/arbiter/util/ClassPathResource.java | ClassPathResource.getFile | public File getFile() throws FileNotFoundException {
URL url = this.getUrl();
if (isJarURL(url)) {
/*
This is actually request for file, that's packed into jar. Probably the current one, but that doesn't matters.
*/
try {
url = extrac... | java | public File getFile() throws FileNotFoundException {
URL url = this.getUrl();
if (isJarURL(url)) {
/*
This is actually request for file, that's packed into jar. Probably the current one, but that doesn't matters.
*/
try {
url = extrac... | [
"public",
"File",
"getFile",
"(",
")",
"throws",
"FileNotFoundException",
"{",
"URL",
"url",
"=",
"this",
".",
"getUrl",
"(",
")",
";",
"if",
"(",
"isJarURL",
"(",
"url",
")",
")",
"{",
"/*\n This is actually request for file, that's packed into jar. ... | Returns requested ClassPathResource as File object
Please note: if this method called from compiled jar, temporary file will be created to provide File access
@return File requested at constructor call
@throws FileNotFoundException | [
"Returns",
"requested",
"ClassPathResource",
"as",
"File",
"object"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/arbiter/arbiter-core/src/main/java/org/deeplearning4j/arbiter/util/ClassPathResource.java#L99-L159 |
128,447 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.putFunctionForId | public void putFunctionForId(String id, DifferentialFunction function) {
if (ops.containsKey(id) && ops.get(id).getOp() == null) {
throw new ND4JIllegalStateException("Function by id already exists!");
} else if (function instanceof SDVariable) {
throw new ND4JIllegalStateExcepti... | java | public void putFunctionForId(String id, DifferentialFunction function) {
if (ops.containsKey(id) && ops.get(id).getOp() == null) {
throw new ND4JIllegalStateException("Function by id already exists!");
} else if (function instanceof SDVariable) {
throw new ND4JIllegalStateExcepti... | [
"public",
"void",
"putFunctionForId",
"(",
"String",
"id",
",",
"DifferentialFunction",
"function",
")",
"{",
"if",
"(",
"ops",
".",
"containsKey",
"(",
"id",
")",
"&&",
"ops",
".",
"get",
"(",
"id",
")",
".",
"getOp",
"(",
")",
"==",
"null",
")",
"{... | Put the function for the given id
@param id the id of the function
@param function the function | [
"Put",
"the",
"function",
"for",
"the",
"given",
"id"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L519-L531 |
128,448 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.putShapeForVarName | @Deprecated
public void putShapeForVarName(String varName, long[] shape) {
if (shape == null) {
throw new ND4JIllegalStateException("Shape must not be null!");
}
if (variableNameToShape.containsKey(varName)) {
throw new ND4JIllegalStateException("Shape for " + varNam... | java | @Deprecated
public void putShapeForVarName(String varName, long[] shape) {
if (shape == null) {
throw new ND4JIllegalStateException("Shape must not be null!");
}
if (variableNameToShape.containsKey(varName)) {
throw new ND4JIllegalStateException("Shape for " + varNam... | [
"@",
"Deprecated",
"public",
"void",
"putShapeForVarName",
"(",
"String",
"varName",
",",
"long",
"[",
"]",
"shape",
")",
"{",
"if",
"(",
"shape",
"==",
"null",
")",
"{",
"throw",
"new",
"ND4JIllegalStateException",
"(",
"\"Shape must not be null!\"",
")",
";"... | Associate a vertex id with the given shape.
@param varName the vertex id to associate
@param shape the shape to associate with
@see #putShapeForVarName(String, long[])
@see #putOrUpdateShapeForVarName(String, long[], boolean) | [
"Associate",
"a",
"vertex",
"id",
"with",
"the",
"given",
"shape",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L661-L672 |
128,449 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.putOrUpdateShapeForVarName | @Deprecated
public void putOrUpdateShapeForVarName(String varName, long[] shape, boolean clearArrayOnShapeMismatch){
Preconditions.checkNotNull(shape, "Cannot put null shape for variable: %s", varName);
if(variableNameToShape.containsKey(varName)){
// updateShapeForVarName(varName, shape,... | java | @Deprecated
public void putOrUpdateShapeForVarName(String varName, long[] shape, boolean clearArrayOnShapeMismatch){
Preconditions.checkNotNull(shape, "Cannot put null shape for variable: %s", varName);
if(variableNameToShape.containsKey(varName)){
// updateShapeForVarName(varName, shape,... | [
"@",
"Deprecated",
"public",
"void",
"putOrUpdateShapeForVarName",
"(",
"String",
"varName",
",",
"long",
"[",
"]",
"shape",
",",
"boolean",
"clearArrayOnShapeMismatch",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"shape",
",",
"\"Cannot put null shape for va... | Put or update the shape for the given variable name. Optionally supports clearing the specified variable's
INDArray if it's shape does not match the new shape
@param varName Variable name
@param shape Shape to put
@param clearArrayOnShapeMismatch If false: no change to arrays. If t... | [
"Put",
"or",
"update",
"the",
"shape",
"for",
"the",
"given",
"variable",
"name",
".",
"Optionally",
"supports",
"clearing",
"the",
"specified",
"variable",
"s",
"INDArray",
"if",
"it",
"s",
"shape",
"does",
"not",
"match",
"the",
"new",
"shape"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L690-L699 |
128,450 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.variableMap | public Map<String, SDVariable> variableMap() {
Map<String,SDVariable> ret = new LinkedHashMap<>();
for(Variable v : variables.values()){
ret.put(v.getName(), v.getVariable());
}
return ret;
} | java | public Map<String, SDVariable> variableMap() {
Map<String,SDVariable> ret = new LinkedHashMap<>();
for(Variable v : variables.values()){
ret.put(v.getName(), v.getVariable());
}
return ret;
} | [
"public",
"Map",
"<",
"String",
",",
"SDVariable",
">",
"variableMap",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"SDVariable",
">",
"ret",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
")",
";",
"for",
"(",
"Variable",
"v",
":",
"variables",
".",
"values",
... | Return a copy of the internal variable map
@return Map of variables by name | [
"Return",
"a",
"copy",
"of",
"the",
"internal",
"variable",
"map"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L888-L894 |
128,451 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.hasArgs | public boolean hasArgs(DifferentialFunction function) {
List<String> vertexIdArgs = ops.get(function.getOwnName()).getInputsToOp();
return vertexIdArgs != null && vertexIdArgs.size() > 0;
} | java | public boolean hasArgs(DifferentialFunction function) {
List<String> vertexIdArgs = ops.get(function.getOwnName()).getInputsToOp();
return vertexIdArgs != null && vertexIdArgs.size() > 0;
} | [
"public",
"boolean",
"hasArgs",
"(",
"DifferentialFunction",
"function",
")",
"{",
"List",
"<",
"String",
">",
"vertexIdArgs",
"=",
"ops",
".",
"get",
"(",
"function",
".",
"getOwnName",
"(",
")",
")",
".",
"getInputsToOp",
"(",
")",
";",
"return",
"vertex... | Returns true if this function already has defined arguments
@param function the function to check
@return true if the function has args, false otherwise | [
"Returns",
"true",
"if",
"this",
"function",
"already",
"has",
"defined",
"arguments"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L1223-L1226 |
128,452 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.functions | public DifferentialFunction[] functions() {
List<DifferentialFunction> out = new ArrayList<>(ops.size());
for(SameDiffOp op : ops.values()){
out.add(op.getOp());
}
return out.toArray(new DifferentialFunction[out.size()]);
} | java | public DifferentialFunction[] functions() {
List<DifferentialFunction> out = new ArrayList<>(ops.size());
for(SameDiffOp op : ops.values()){
out.add(op.getOp());
}
return out.toArray(new DifferentialFunction[out.size()]);
} | [
"public",
"DifferentialFunction",
"[",
"]",
"functions",
"(",
")",
"{",
"List",
"<",
"DifferentialFunction",
">",
"out",
"=",
"new",
"ArrayList",
"<>",
"(",
"ops",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"SameDiffOp",
"op",
":",
"ops",
".",
"value... | Get an array of differential functions that have been defined for this SameDiff instance
@return Array of differential functions | [
"Get",
"an",
"array",
"of",
"differential",
"functions",
"that",
"have",
"been",
"defined",
"for",
"this",
"SameDiff",
"instance"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L1232-L1238 |
128,453 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.one | public SDVariable one(String name, org.nd4j.linalg.api.buffer.DataType dataType, int... shape) {
return var(name, new ConstantInitScheme('f', 1.0), dataType, ArrayUtil.toLongArray(shape));
} | java | public SDVariable one(String name, org.nd4j.linalg.api.buffer.DataType dataType, int... shape) {
return var(name, new ConstantInitScheme('f', 1.0), dataType, ArrayUtil.toLongArray(shape));
} | [
"public",
"SDVariable",
"one",
"(",
"String",
"name",
",",
"org",
".",
"nd4j",
".",
"linalg",
".",
"api",
".",
"buffer",
".",
"DataType",
"dataType",
",",
"int",
"...",
"shape",
")",
"{",
"return",
"var",
"(",
"name",
",",
"new",
"ConstantInitScheme",
... | Create a new variable with the specified shape, with all values initialized to 1.0
@param name the name of the variable to create
@param shape the shape of the array to be created
@return the created variable | [
"Create",
"a",
"new",
"variable",
"with",
"the",
"specified",
"shape",
"with",
"all",
"values",
"initialized",
"to",
"1",
".",
"0"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L1946-L1948 |
128,454 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.zero | public SDVariable zero(String name, org.nd4j.linalg.api.buffer.DataType dataType, int... shape) {
return var(name, new ZeroInitScheme(), dataType, ArrayUtil.toLongArray(shape));
} | java | public SDVariable zero(String name, org.nd4j.linalg.api.buffer.DataType dataType, int... shape) {
return var(name, new ZeroInitScheme(), dataType, ArrayUtil.toLongArray(shape));
} | [
"public",
"SDVariable",
"zero",
"(",
"String",
"name",
",",
"org",
".",
"nd4j",
".",
"linalg",
".",
"api",
".",
"buffer",
".",
"DataType",
"dataType",
",",
"int",
"...",
"shape",
")",
"{",
"return",
"var",
"(",
"name",
",",
"new",
"ZeroInitScheme",
"("... | Create a new variable with the specified shape, with all values initialized to 0
@param name the name of the variable to create
@param shape the shape of the array to be created
@return the created variable | [
"Create",
"a",
"new",
"variable",
"with",
"the",
"specified",
"shape",
"with",
"all",
"values",
"initialized",
"to",
"0"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L1989-L1991 |
128,455 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.removeArgFromFunction | public void removeArgFromFunction(String varName, DifferentialFunction function) {
val args = function.args();
for (int i = 0; i < args.length; i++) {
if (args[i].getVarName().equals(varName)) {
/**
* Since we are removing the variable reference
... | java | public void removeArgFromFunction(String varName, DifferentialFunction function) {
val args = function.args();
for (int i = 0; i < args.length; i++) {
if (args[i].getVarName().equals(varName)) {
/**
* Since we are removing the variable reference
... | [
"public",
"void",
"removeArgFromFunction",
"(",
"String",
"varName",
",",
"DifferentialFunction",
"function",
")",
"{",
"val",
"args",
"=",
"function",
".",
"args",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"args",
".",
"length",
... | Remove an argument for a function. Note that if this function does not contain the argument, it will just be a no op.
@param varName the variable name to remove
@param function the function to remove the argument from | [
"Remove",
"an",
"argument",
"for",
"a",
"function",
".",
"Note",
"that",
"if",
"this",
"function",
"does",
"not",
"contain",
"the",
"argument",
"it",
"will",
"just",
"be",
"a",
"no",
"op",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L2545-L2567 |
128,456 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.getVariable | public SDVariable getVariable(String name) {
Variable v = variables.get(name);
return v == null ? null : v.getVariable();
} | java | public SDVariable getVariable(String name) {
Variable v = variables.get(name);
return v == null ? null : v.getVariable();
} | [
"public",
"SDVariable",
"getVariable",
"(",
"String",
"name",
")",
"{",
"Variable",
"v",
"=",
"variables",
".",
"get",
"(",
"name",
")",
";",
"return",
"v",
"==",
"null",
"?",
"null",
":",
"v",
".",
"getVariable",
"(",
")",
";",
"}"
] | Get the variable based on the opName
@param name the opName of the variable
@return the variabel instance if there is one | [
"Get",
"the",
"variable",
"based",
"on",
"the",
"opName"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L2575-L2578 |
128,457 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.setGradientForVariableName | public void setGradientForVariableName(String variableName, SDVariable variable) {
Preconditions.checkState(variables.containsKey(variableName), "No variable exists with name \"%s\"", variableName);
if (variable == null) {
throw new ND4JIllegalStateException("Unable to set null gradient for ... | java | public void setGradientForVariableName(String variableName, SDVariable variable) {
Preconditions.checkState(variables.containsKey(variableName), "No variable exists with name \"%s\"", variableName);
if (variable == null) {
throw new ND4JIllegalStateException("Unable to set null gradient for ... | [
"public",
"void",
"setGradientForVariableName",
"(",
"String",
"variableName",
",",
"SDVariable",
"variable",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"variables",
".",
"containsKey",
"(",
"variableName",
")",
",",
"\"No variable exists with name \\\"%s\\\"\"",
... | Assign a SDVariable to represent the gradient of the SDVariable with the specified name
@param variableName the variable name to assign the gradient variable for
@param variable the gradient variable | [
"Assign",
"a",
"SDVariable",
"to",
"represent",
"the",
"gradient",
"of",
"the",
"SDVariable",
"with",
"the",
"specified",
"name"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L2640-L2646 |
128,458 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.addVariable | public SDVariable addVariable(SDVariable variable) {
Preconditions.checkState(variable.getSameDiff() == this, "Samediff instance must be the same.");
if (variables.containsKey(variable.getVarName()) && !variables.get(variable.getVarName()).getVariable().equals(variable)) {
throw new Illegal... | java | public SDVariable addVariable(SDVariable variable) {
Preconditions.checkState(variable.getSameDiff() == this, "Samediff instance must be the same.");
if (variables.containsKey(variable.getVarName()) && !variables.get(variable.getVarName()).getVariable().equals(variable)) {
throw new Illegal... | [
"public",
"SDVariable",
"addVariable",
"(",
"SDVariable",
"variable",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"variable",
".",
"getSameDiff",
"(",
")",
"==",
"this",
",",
"\"Samediff instance must be the same.\"",
")",
";",
"if",
"(",
"variables",
".",
... | Add the specified variable to this SameDiff instance
@param variable Variable to add | [
"Add",
"the",
"specified",
"variable",
"to",
"this",
"SameDiff",
"instance"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L2838-L2848 |
128,459 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.updateVariableNamesAndReferences | public SDVariable[] updateVariableNamesAndReferences(SDVariable[] variablesToUpdate, String[] newVariableNames) {
int numVariables = variablesToUpdate.length;
SDVariable[] updatedVariables = new SDVariable[numVariables];
for (int i = 0; i < numVariables; i++) {
SDVariable varToUpda... | java | public SDVariable[] updateVariableNamesAndReferences(SDVariable[] variablesToUpdate, String[] newVariableNames) {
int numVariables = variablesToUpdate.length;
SDVariable[] updatedVariables = new SDVariable[numVariables];
for (int i = 0; i < numVariables; i++) {
SDVariable varToUpda... | [
"public",
"SDVariable",
"[",
"]",
"updateVariableNamesAndReferences",
"(",
"SDVariable",
"[",
"]",
"variablesToUpdate",
",",
"String",
"[",
"]",
"newVariableNames",
")",
"{",
"int",
"numVariables",
"=",
"variablesToUpdate",
".",
"length",
";",
"SDVariable",
"[",
"... | Updates the variable name property on the passed in variables, its reference in samediff, and returns the variable.
@param variablesToUpdate the variable to update
@param newVariableNames the new variable name
@return the updated, passed in variables | [
"Updates",
"the",
"variable",
"name",
"property",
"on",
"the",
"passed",
"in",
"variables",
"its",
"reference",
"in",
"samediff",
"and",
"returns",
"the",
"variable",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L3842-L3854 |
128,460 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.asFlatGraph | public FlatGraph asFlatGraph(long graphId, ExecutorConfiguration configuration) {
return FlatGraph.getRootAsFlatGraph(asFlatBuffers(graphId, configuration));
} | java | public FlatGraph asFlatGraph(long graphId, ExecutorConfiguration configuration) {
return FlatGraph.getRootAsFlatGraph(asFlatBuffers(graphId, configuration));
} | [
"public",
"FlatGraph",
"asFlatGraph",
"(",
"long",
"graphId",
",",
"ExecutorConfiguration",
"configuration",
")",
"{",
"return",
"FlatGraph",
".",
"getRootAsFlatGraph",
"(",
"asFlatBuffers",
"(",
"graphId",
",",
"configuration",
")",
")",
";",
"}"
] | This method returns FlatGraph structure
@param configuration
@return | [
"This",
"method",
"returns",
"FlatGraph",
"structure"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L4348-L4350 |
128,461 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.saveWithTrainingConfig | public void saveWithTrainingConfig(TrainingConfig trainingConfig,OutputStream outputStream) throws IOException {
ObjectMapper objectMapper = ObjectMapperHolder.getJsonMapper();
String configJson = objectMapper.writeValueAsString(trainingConfig);
ZipOutputStream zipfile = new ZipOutputStream(new... | java | public void saveWithTrainingConfig(TrainingConfig trainingConfig,OutputStream outputStream) throws IOException {
ObjectMapper objectMapper = ObjectMapperHolder.getJsonMapper();
String configJson = objectMapper.writeValueAsString(trainingConfig);
ZipOutputStream zipfile = new ZipOutputStream(new... | [
"public",
"void",
"saveWithTrainingConfig",
"(",
"TrainingConfig",
"trainingConfig",
",",
"OutputStream",
"outputStream",
")",
"throws",
"IOException",
"{",
"ObjectMapper",
"objectMapper",
"=",
"ObjectMapperHolder",
".",
"getJsonMapper",
"(",
")",
";",
"String",
"config... | Save this samediff instance as a zip file
with the training configuration
@param trainingConfig the training configuration to save
@param outputStream the output stream to write to
@throws IOException | [
"Save",
"this",
"samediff",
"instance",
"as",
"a",
"zip",
"file",
"with",
"the",
"training",
"configuration"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L4416-L4436 |
128,462 | deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/transform/serde/BaseSerializer.java | BaseSerializer.serializeTransformList | public String serializeTransformList(List<Transform> list) {
ObjectMapper om = getObjectMapper();
try {
return om.writeValueAsString(new ListWrappers.TransformList(list));
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public String serializeTransformList(List<Transform> list) {
ObjectMapper om = getObjectMapper();
try {
return om.writeValueAsString(new ListWrappers.TransformList(list));
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"String",
"serializeTransformList",
"(",
"List",
"<",
"Transform",
">",
"list",
")",
"{",
"ObjectMapper",
"om",
"=",
"getObjectMapper",
"(",
")",
";",
"try",
"{",
"return",
"om",
".",
"writeValueAsString",
"(",
"new",
"ListWrappers",
".",
"TransformL... | Serialize a list of Transforms | [
"Serialize",
"a",
"list",
"of",
"Transforms"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/transform/serde/BaseSerializer.java#L97-L104 |
128,463 | deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/transform/serde/BaseSerializer.java | BaseSerializer.serializeFilterList | public String serializeFilterList(List<Filter> list) {
ObjectMapper om = getObjectMapper();
try {
return om.writeValueAsString(new ListWrappers.FilterList(list));
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public String serializeFilterList(List<Filter> list) {
ObjectMapper om = getObjectMapper();
try {
return om.writeValueAsString(new ListWrappers.FilterList(list));
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"String",
"serializeFilterList",
"(",
"List",
"<",
"Filter",
">",
"list",
")",
"{",
"ObjectMapper",
"om",
"=",
"getObjectMapper",
"(",
")",
";",
"try",
"{",
"return",
"om",
".",
"writeValueAsString",
"(",
"new",
"ListWrappers",
".",
"FilterList",
"... | Serialize a list of Filters | [
"Serialize",
"a",
"list",
"of",
"Filters"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/transform/serde/BaseSerializer.java#L114-L121 |
128,464 | deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/transform/serde/BaseSerializer.java | BaseSerializer.serializeConditionList | public String serializeConditionList(List<Condition> list) {
ObjectMapper om = getObjectMapper();
try {
return om.writeValueAsString(new ListWrappers.ConditionList(list));
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public String serializeConditionList(List<Condition> list) {
ObjectMapper om = getObjectMapper();
try {
return om.writeValueAsString(new ListWrappers.ConditionList(list));
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"String",
"serializeConditionList",
"(",
"List",
"<",
"Condition",
">",
"list",
")",
"{",
"ObjectMapper",
"om",
"=",
"getObjectMapper",
"(",
")",
";",
"try",
"{",
"return",
"om",
".",
"writeValueAsString",
"(",
"new",
"ListWrappers",
".",
"ConditionL... | Serialize a list of Conditions | [
"Serialize",
"a",
"list",
"of",
"Conditions"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/transform/serde/BaseSerializer.java#L130-L137 |
128,465 | deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/transform/serde/BaseSerializer.java | BaseSerializer.serializeReducerList | public String serializeReducerList(List<IAssociativeReducer> list) {
ObjectMapper om = getObjectMapper();
try {
return om.writeValueAsString(new ListWrappers.ReducerList(list));
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public String serializeReducerList(List<IAssociativeReducer> list) {
ObjectMapper om = getObjectMapper();
try {
return om.writeValueAsString(new ListWrappers.ReducerList(list));
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"String",
"serializeReducerList",
"(",
"List",
"<",
"IAssociativeReducer",
">",
"list",
")",
"{",
"ObjectMapper",
"om",
"=",
"getObjectMapper",
"(",
")",
";",
"try",
"{",
"return",
"om",
".",
"writeValueAsString",
"(",
"new",
"ListWrappers",
".",
"Re... | Serialize a list of IReducers | [
"Serialize",
"a",
"list",
"of",
"IReducers"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/transform/serde/BaseSerializer.java#L146-L153 |
128,466 | deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/transform/serde/BaseSerializer.java | BaseSerializer.serializeSequenceComparatorList | public String serializeSequenceComparatorList(List<SequenceComparator> list) {
ObjectMapper om = getObjectMapper();
try {
return om.writeValueAsString(new ListWrappers.SequenceComparatorList(list));
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public String serializeSequenceComparatorList(List<SequenceComparator> list) {
ObjectMapper om = getObjectMapper();
try {
return om.writeValueAsString(new ListWrappers.SequenceComparatorList(list));
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"String",
"serializeSequenceComparatorList",
"(",
"List",
"<",
"SequenceComparator",
">",
"list",
")",
"{",
"ObjectMapper",
"om",
"=",
"getObjectMapper",
"(",
")",
";",
"try",
"{",
"return",
"om",
".",
"writeValueAsString",
"(",
"new",
"ListWrappers",
... | Serialize a list of SequenceComparators | [
"Serialize",
"a",
"list",
"of",
"SequenceComparators"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/transform/serde/BaseSerializer.java#L162-L169 |
128,467 | deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/transform/serde/BaseSerializer.java | BaseSerializer.serializeDataActionList | public String serializeDataActionList(List<DataAction> list) {
ObjectMapper om = getObjectMapper();
try {
return om.writeValueAsString(new ListWrappers.DataActionList(list));
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public String serializeDataActionList(List<DataAction> list) {
ObjectMapper om = getObjectMapper();
try {
return om.writeValueAsString(new ListWrappers.DataActionList(list));
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"String",
"serializeDataActionList",
"(",
"List",
"<",
"DataAction",
">",
"list",
")",
"{",
"ObjectMapper",
"om",
"=",
"getObjectMapper",
"(",
")",
";",
"try",
"{",
"return",
"om",
".",
"writeValueAsString",
"(",
"new",
"ListWrappers",
".",
"DataActi... | Serialize a list of DataActions | [
"Serialize",
"a",
"list",
"of",
"DataActions"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/transform/serde/BaseSerializer.java#L178-L185 |
128,468 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-zoo/src/main/java/org/deeplearning4j/zoo/ZooModel.java | ZooModel.initPretrained | public <M extends Model> M initPretrained(PretrainedType pretrainedType) throws IOException {
String remoteUrl = pretrainedUrl(pretrainedType);
if (remoteUrl == null)
throw new UnsupportedOperationException(
"Pretrained " + pretrainedType + " weights are not avail... | java | public <M extends Model> M initPretrained(PretrainedType pretrainedType) throws IOException {
String remoteUrl = pretrainedUrl(pretrainedType);
if (remoteUrl == null)
throw new UnsupportedOperationException(
"Pretrained " + pretrainedType + " weights are not avail... | [
"public",
"<",
"M",
"extends",
"Model",
">",
"M",
"initPretrained",
"(",
"PretrainedType",
"pretrainedType",
")",
"throws",
"IOException",
"{",
"String",
"remoteUrl",
"=",
"pretrainedUrl",
"(",
"pretrainedType",
")",
";",
"if",
"(",
"remoteUrl",
"==",
"null",
... | Returns a pretrained model for the given dataset, if available.
@param pretrainedType
@return
@throws IOException | [
"Returns",
"a",
"pretrained",
"model",
"for",
"the",
"given",
"dataset",
"if",
"available",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-zoo/src/main/java/org/deeplearning4j/zoo/ZooModel.java#L64-L106 |
128,469 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/recurrent/KerasRnnUtils.java | KerasRnnUtils.getUnrollRecurrentLayer | public static boolean getUnrollRecurrentLayer(KerasLayerConfiguration conf, Map<String, Object> layerConfig)
throws InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
if (!innerConfig.containsKey(conf.getLA... | java | public static boolean getUnrollRecurrentLayer(KerasLayerConfiguration conf, Map<String, Object> layerConfig)
throws InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
if (!innerConfig.containsKey(conf.getLA... | [
"public",
"static",
"boolean",
"getUnrollRecurrentLayer",
"(",
"KerasLayerConfiguration",
"conf",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
")",
"throws",
"InvalidKerasConfigurationException",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"inner... | Get unroll parameter to decide whether to unroll RNN with BPTT or not.
@param conf KerasLayerConfiguration
@param layerConfig dictionary containing Keras layer properties
@return boolean unroll parameter
@throws InvalidKerasConfigurationException Invalid Keras configuration | [
"Get",
"unroll",
"parameter",
"to",
"decide",
"whether",
"to",
"unroll",
"RNN",
"with",
"BPTT",
"or",
"not",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/recurrent/KerasRnnUtils.java#L41-L48 |
128,470 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/recurrent/KerasRnnUtils.java | KerasRnnUtils.getRecurrentDropout | public static double getRecurrentDropout(KerasLayerConfiguration conf, Map<String, Object> layerConfig)
throws UnsupportedKerasConfigurationException, InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
doub... | java | public static double getRecurrentDropout(KerasLayerConfiguration conf, Map<String, Object> layerConfig)
throws UnsupportedKerasConfigurationException, InvalidKerasConfigurationException {
Map<String, Object> innerConfig = KerasLayerUtils.getInnerLayerConfigFromConfig(layerConfig, conf);
doub... | [
"public",
"static",
"double",
"getRecurrentDropout",
"(",
"KerasLayerConfiguration",
"conf",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"layerConfig",
")",
"throws",
"UnsupportedKerasConfigurationException",
",",
"InvalidKerasConfigurationException",
"{",
"Map",
"<",
... | Get recurrent weight dropout from Keras layer configuration.
Non-zero dropout rates are currently not supported.
@param conf KerasLayerConfiguration
@param layerConfig dictionary containing Keras layer properties
@return recurrent dropout rate
@throws InvalidKerasConfigurationException Invalid Keras configurati... | [
"Get",
"recurrent",
"weight",
"dropout",
"from",
"Keras",
"layer",
"configuration",
".",
"Non",
"-",
"zero",
"dropout",
"rates",
"are",
"currently",
"not",
"supported",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/recurrent/KerasRnnUtils.java#L59-L74 |
128,471 | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/resources/Downloader.java | Downloader.download | public static void download(String name, URL url, File f, String targetMD5, int maxTries) throws IOException {
download(name, url, f, targetMD5, maxTries, 0);
} | java | public static void download(String name, URL url, File f, String targetMD5, int maxTries) throws IOException {
download(name, url, f, targetMD5, maxTries, 0);
} | [
"public",
"static",
"void",
"download",
"(",
"String",
"name",
",",
"URL",
"url",
",",
"File",
"f",
",",
"String",
"targetMD5",
",",
"int",
"maxTries",
")",
"throws",
"IOException",
"{",
"download",
"(",
"name",
",",
"url",
",",
"f",
",",
"targetMD5",
... | Download the specified URL to the specified file, and verify that the target MD5 matches
@param name Name (mainly for providing useful exceptions)
@param url URL to download
@param f Destination file
@param targetMD5 Expected MD5 for file
@param maxTries Maximum number of download attempts before fa... | [
"Download",
"the",
"specified",
"URL",
"to",
"the",
"specified",
"file",
"and",
"verify",
"that",
"the",
"target",
"MD5",
"matches"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/resources/Downloader.java#L49-L51 |
128,472 | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/resources/Downloader.java | Downloader.checkMD5OfFile | public static boolean checkMD5OfFile(String targetMD5, File file) throws IOException {
InputStream in = FileUtils.openInputStream(file);
String trueMd5 = DigestUtils.md5Hex(in);
IOUtils.closeQuietly(in);
return (targetMD5.equals(trueMd5));
} | java | public static boolean checkMD5OfFile(String targetMD5, File file) throws IOException {
InputStream in = FileUtils.openInputStream(file);
String trueMd5 = DigestUtils.md5Hex(in);
IOUtils.closeQuietly(in);
return (targetMD5.equals(trueMd5));
} | [
"public",
"static",
"boolean",
"checkMD5OfFile",
"(",
"String",
"targetMD5",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"InputStream",
"in",
"=",
"FileUtils",
".",
"openInputStream",
"(",
"file",
")",
";",
"String",
"trueMd5",
"=",
"DigestUtils",
... | Check the MD5 of the specified file
@param targetMD5 Expected MD5
@param file File to check
@return True if MD5 matches, false otherwise | [
"Check",
"the",
"MD5",
"of",
"the",
"specified",
"file"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/resources/Downloader.java#L118-L123 |
128,473 | deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-rocksdb-storage/src/main/java/org/nd4j/parameterserver/updater/storage/RocksDbStorage.java | RocksDbStorage.addUpdate | @Override
public void addUpdate(NDArrayMessage array) {
UnsafeBuffer directBuffer = (UnsafeBuffer) NDArrayMessage.toBuffer(array);
byte[] data = directBuffer.byteArray();
if (data == null) {
data = new byte[directBuffer.capacity()];
directBuffer.getBytes(0, data, 0, d... | java | @Override
public void addUpdate(NDArrayMessage array) {
UnsafeBuffer directBuffer = (UnsafeBuffer) NDArrayMessage.toBuffer(array);
byte[] data = directBuffer.byteArray();
if (data == null) {
data = new byte[directBuffer.capacity()];
directBuffer.getBytes(0, data, 0, d... | [
"@",
"Override",
"public",
"void",
"addUpdate",
"(",
"NDArrayMessage",
"array",
")",
"{",
"UnsafeBuffer",
"directBuffer",
"=",
"(",
"UnsafeBuffer",
")",
"NDArrayMessage",
".",
"toBuffer",
"(",
"array",
")",
";",
"byte",
"[",
"]",
"data",
"=",
"directBuffer",
... | Add an ndarray to the storage
@param array the array to add | [
"Add",
"an",
"ndarray",
"to",
"the",
"storage"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-rocksdb-storage/src/main/java/org/nd4j/parameterserver/updater/storage/RocksDbStorage.java#L60-L77 |
128,474 | deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-rocksdb-storage/src/main/java/org/nd4j/parameterserver/updater/storage/RocksDbStorage.java | RocksDbStorage.clear | @Override
public void clear() {
RocksIterator iterator = db.newIterator();
while (iterator.isValid())
try {
db.remove(iterator.key());
} catch (RocksDBException e) {
throw new RuntimeException(e);
}
iterator.close();
... | java | @Override
public void clear() {
RocksIterator iterator = db.newIterator();
while (iterator.isValid())
try {
db.remove(iterator.key());
} catch (RocksDBException e) {
throw new RuntimeException(e);
}
iterator.close();
... | [
"@",
"Override",
"public",
"void",
"clear",
"(",
")",
"{",
"RocksIterator",
"iterator",
"=",
"db",
".",
"newIterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"isValid",
"(",
")",
")",
"try",
"{",
"db",
".",
"remove",
"(",
"iterator",
".",
"key... | Clear the array storage | [
"Clear",
"the",
"array",
"storage"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-rocksdb-storage/src/main/java/org/nd4j/parameterserver/updater/storage/RocksDbStorage.java#L93-L104 |
128,475 | deeplearning4j/deeplearning4j | nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-rocksdb-storage/src/main/java/org/nd4j/parameterserver/updater/storage/RocksDbStorage.java | RocksDbStorage.doGetUpdate | @Override
public NDArrayMessage doGetUpdate(int index) {
byte[] key = ByteBuffer.allocate(4).putInt(index).array();
try {
UnsafeBuffer unsafeBuffer = new UnsafeBuffer(db.get(key));
return NDArrayMessage.fromBuffer(unsafeBuffer, 0);
} catch (RocksDBException e) {
... | java | @Override
public NDArrayMessage doGetUpdate(int index) {
byte[] key = ByteBuffer.allocate(4).putInt(index).array();
try {
UnsafeBuffer unsafeBuffer = new UnsafeBuffer(db.get(key));
return NDArrayMessage.fromBuffer(unsafeBuffer, 0);
} catch (RocksDBException e) {
... | [
"@",
"Override",
"public",
"NDArrayMessage",
"doGetUpdate",
"(",
"int",
"index",
")",
"{",
"byte",
"[",
"]",
"key",
"=",
"ByteBuffer",
".",
"allocate",
"(",
"4",
")",
".",
"putInt",
"(",
"index",
")",
".",
"array",
"(",
")",
";",
"try",
"{",
"UnsafeB... | A method for actually performing the implementation
of retrieving the ndarray
@param index the index of the {@link INDArray} to get
@return the ndarray at the specified index | [
"A",
"method",
"for",
"actually",
"performing",
"the",
"implementation",
"of",
"retrieving",
"the",
"ndarray"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-parameter-server-parent/nd4j-parameter-server-rocksdb-storage/src/main/java/org/nd4j/parameterserver/updater/storage/RocksDbStorage.java#L113-L122 |
128,476 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/params/SeparableConvolutionParamInitializer.java | SeparableConvolutionParamInitializer.numDepthWiseParams | private long numDepthWiseParams(SeparableConvolution2D layerConf) {
int[] kernel = layerConf.getKernelSize();
val nIn = layerConf.getNIn();
val depthMultiplier = layerConf.getDepthMultiplier();
return nIn * depthMultiplier * kernel[0] * kernel[1];
} | java | private long numDepthWiseParams(SeparableConvolution2D layerConf) {
int[] kernel = layerConf.getKernelSize();
val nIn = layerConf.getNIn();
val depthMultiplier = layerConf.getDepthMultiplier();
return nIn * depthMultiplier * kernel[0] * kernel[1];
} | [
"private",
"long",
"numDepthWiseParams",
"(",
"SeparableConvolution2D",
"layerConf",
")",
"{",
"int",
"[",
"]",
"kernel",
"=",
"layerConf",
".",
"getKernelSize",
"(",
")",
";",
"val",
"nIn",
"=",
"layerConf",
".",
"getNIn",
"(",
")",
";",
"val",
"depthMultip... | For each input feature we separately compute depthMultiplier many
output maps for the given kernel size
@param layerConf layer configuration of the separable conv2d layer
@return number of parameters of the channels-wise convolution operation | [
"For",
"each",
"input",
"feature",
"we",
"separately",
"compute",
"depthMultiplier",
"many",
"output",
"maps",
"for",
"the",
"given",
"kernel",
"size"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/params/SeparableConvolutionParamInitializer.java#L76-L82 |
128,477 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/preprocessing/text/KerasTokenizer.java | KerasTokenizer.textToWordSequence | public static String[] textToWordSequence(String text, String filters, boolean lower, String split) {
if (lower)
text = text.toLowerCase();
for (String filter: filters.split("")) {
text = text.replace(filter, split);
}
String[] sequences = text.split(split);
... | java | public static String[] textToWordSequence(String text, String filters, boolean lower, String split) {
if (lower)
text = text.toLowerCase();
for (String filter: filters.split("")) {
text = text.replace(filter, split);
}
String[] sequences = text.split(split);
... | [
"public",
"static",
"String",
"[",
"]",
"textToWordSequence",
"(",
"String",
"text",
",",
"String",
"filters",
",",
"boolean",
"lower",
",",
"String",
"split",
")",
"{",
"if",
"(",
"lower",
")",
"text",
"=",
"text",
".",
"toLowerCase",
"(",
")",
";",
"... | Turns a String text into a sequence of tokens.
@param text input text
@param filters characters to filter
@param lower whether to lowercase input or not
@param split by which string to split words (usually single space)
@return Sequence of tokens as String arr... | [
"Turns",
"a",
"String",
"text",
"into",
"a",
"sequence",
"of",
"tokens",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/preprocessing/text/KerasTokenizer.java#L156-L168 |
128,478 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/preprocessing/text/KerasTokenizer.java | KerasTokenizer.fitOnTexts | public void fitOnTexts(String[] texts) {
String[] sequence;
for (String text : texts) {
if (documentCount == null)
documentCount = 1;
else
documentCount += 1;
if (charLevel) {
if (lower)
text = text.t... | java | public void fitOnTexts(String[] texts) {
String[] sequence;
for (String text : texts) {
if (documentCount == null)
documentCount = 1;
else
documentCount += 1;
if (charLevel) {
if (lower)
text = text.t... | [
"public",
"void",
"fitOnTexts",
"(",
"String",
"[",
"]",
"texts",
")",
"{",
"String",
"[",
"]",
"sequence",
";",
"for",
"(",
"String",
"text",
":",
"texts",
")",
"{",
"if",
"(",
"documentCount",
"==",
"null",
")",
"documentCount",
"=",
"1",
";",
"els... | Fit this tokenizer on a corpus of texts.
@param texts array of strings to fit tokenizer on. | [
"Fit",
"this",
"tokenizer",
"on",
"a",
"corpus",
"of",
"texts",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/preprocessing/text/KerasTokenizer.java#L175-L221 |
128,479 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/preprocessing/text/KerasTokenizer.java | KerasTokenizer.reverseSortByValues | private static HashMap reverseSortByValues(HashMap map) {
List list = new LinkedList(map.entrySet());
Collections.sort(list, new Comparator() {
public int compare(Object o1, Object o2) {
return ((Comparable) ((Map.Entry) (o1)).getValue())
.compareTo(((... | java | private static HashMap reverseSortByValues(HashMap map) {
List list = new LinkedList(map.entrySet());
Collections.sort(list, new Comparator() {
public int compare(Object o1, Object o2) {
return ((Comparable) ((Map.Entry) (o1)).getValue())
.compareTo(((... | [
"private",
"static",
"HashMap",
"reverseSortByValues",
"(",
"HashMap",
"map",
")",
"{",
"List",
"list",
"=",
"new",
"LinkedList",
"(",
"map",
".",
"entrySet",
"(",
")",
")",
";",
"Collections",
".",
"sort",
"(",
"list",
",",
"new",
"Comparator",
"(",
")"... | Sort HashMap by values in reverse order
@param map input HashMap
@return sorted HashMap | [
"Sort",
"HashMap",
"by",
"values",
"in",
"reverse",
"order"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/preprocessing/text/KerasTokenizer.java#L229-L243 |
128,480 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/preprocessing/text/KerasTokenizer.java | KerasTokenizer.fitOnSequences | public void fitOnSequences(Integer[][] sequences) {
documentCount += 1;
for (Integer[] sequence: sequences) {
Set<Integer> sequenceSet = new HashSet<>(Arrays.asList(sequence));
for (Integer index: sequenceSet)
indexDocs.put(index, indexDocs.get(index) + 1);
... | java | public void fitOnSequences(Integer[][] sequences) {
documentCount += 1;
for (Integer[] sequence: sequences) {
Set<Integer> sequenceSet = new HashSet<>(Arrays.asList(sequence));
for (Integer index: sequenceSet)
indexDocs.put(index, indexDocs.get(index) + 1);
... | [
"public",
"void",
"fitOnSequences",
"(",
"Integer",
"[",
"]",
"[",
"]",
"sequences",
")",
"{",
"documentCount",
"+=",
"1",
";",
"for",
"(",
"Integer",
"[",
"]",
"sequence",
":",
"sequences",
")",
"{",
"Set",
"<",
"Integer",
">",
"sequenceSet",
"=",
"ne... | Fit this tokenizer on a corpus of word indices
@param sequences array of indices derived from a text. | [
"Fit",
"this",
"tokenizer",
"on",
"a",
"corpus",
"of",
"word",
"indices"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/preprocessing/text/KerasTokenizer.java#L250-L257 |
128,481 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/preprocessing/text/KerasTokenizer.java | KerasTokenizer.textsToSequences | public Integer[][] textsToSequences(String[] texts) {
Integer oovTokenIndex = wordIndex.get(outOfVocabularyToken);
String[] wordSequence;
ArrayList<Integer[]> sequences = new ArrayList<>();
for (String text: texts) {
if (charLevel) {
if (lower) {
... | java | public Integer[][] textsToSequences(String[] texts) {
Integer oovTokenIndex = wordIndex.get(outOfVocabularyToken);
String[] wordSequence;
ArrayList<Integer[]> sequences = new ArrayList<>();
for (String text: texts) {
if (charLevel) {
if (lower) {
... | [
"public",
"Integer",
"[",
"]",
"[",
"]",
"textsToSequences",
"(",
"String",
"[",
"]",
"texts",
")",
"{",
"Integer",
"oovTokenIndex",
"=",
"wordIndex",
".",
"get",
"(",
"outOfVocabularyToken",
")",
";",
"String",
"[",
"]",
"wordSequence",
";",
"ArrayList",
... | Transforms a bunch of texts into their index representations.
@param texts input texts
@return array of indices of the texts | [
"Transforms",
"a",
"bunch",
"of",
"texts",
"into",
"their",
"index",
"representations",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/preprocessing/text/KerasTokenizer.java#L265-L296 |
128,482 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/preprocessing/text/KerasTokenizer.java | KerasTokenizer.sequencesToTexts | public String[] sequencesToTexts(Integer[][] sequences) {
Integer oovTokenIndex = wordIndex.get(outOfVocabularyToken);
ArrayList<String> texts = new ArrayList<>();
for (Integer[] sequence: sequences) {
ArrayList<String> wordVector = new ArrayList<>();
for (Integer index:... | java | public String[] sequencesToTexts(Integer[][] sequences) {
Integer oovTokenIndex = wordIndex.get(outOfVocabularyToken);
ArrayList<String> texts = new ArrayList<>();
for (Integer[] sequence: sequences) {
ArrayList<String> wordVector = new ArrayList<>();
for (Integer index:... | [
"public",
"String",
"[",
"]",
"sequencesToTexts",
"(",
"Integer",
"[",
"]",
"[",
"]",
"sequences",
")",
"{",
"Integer",
"oovTokenIndex",
"=",
"wordIndex",
".",
"get",
"(",
"outOfVocabularyToken",
")",
";",
"ArrayList",
"<",
"String",
">",
"texts",
"=",
"ne... | Turns index sequences back into texts
@param sequences index sequences
@return text reconstructed from sequences | [
"Turns",
"index",
"sequences",
"back",
"into",
"texts"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/preprocessing/text/KerasTokenizer.java#L305-L332 |
128,483 | deeplearning4j/deeplearning4j | nd4j/nd4j-serde/nd4j-aeron/src/main/java/org/nd4j/aeron/ndarrayholder/InMemoryNDArrayHolder.java | InMemoryNDArrayHolder.setArray | @Override
public void setArray(INDArray arr) {
if (this.arr.get() == null)
this.arr.set(arr);
} | java | @Override
public void setArray(INDArray arr) {
if (this.arr.get() == null)
this.arr.set(arr);
} | [
"@",
"Override",
"public",
"void",
"setArray",
"(",
"INDArray",
"arr",
")",
"{",
"if",
"(",
"this",
".",
"arr",
".",
"get",
"(",
")",
"==",
"null",
")",
"this",
".",
"arr",
".",
"set",
"(",
"arr",
")",
";",
"}"
] | Set the ndarray
@param arr the ndarray for this holder
to use | [
"Set",
"the",
"ndarray"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-serde/nd4j-aeron/src/main/java/org/nd4j/aeron/ndarrayholder/InMemoryNDArrayHolder.java#L55-L59 |
128,484 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/imports/tensorflow/TensorFlowImportValidator.java | TensorFlowImportValidator.checkAllModelsForImport | public static TFImportStatus checkAllModelsForImport(File directory) throws IOException {
Preconditions.checkState(directory.isDirectory(), "Specified directory %s is not actually a directory", directory);
Collection<File> files = FileUtils.listFiles(directory, new String[]{"pb"}, true);
Precon... | java | public static TFImportStatus checkAllModelsForImport(File directory) throws IOException {
Preconditions.checkState(directory.isDirectory(), "Specified directory %s is not actually a directory", directory);
Collection<File> files = FileUtils.listFiles(directory, new String[]{"pb"}, true);
Precon... | [
"public",
"static",
"TFImportStatus",
"checkAllModelsForImport",
"(",
"File",
"directory",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkState",
"(",
"directory",
".",
"isDirectory",
"(",
")",
",",
"\"Specified directory %s is not actually a directory\"",
... | Recursively scan the specified directory for .pb files, and evaluate
@param directory
@return
@throws IOException | [
"Recursively",
"scan",
"the",
"specified",
"directory",
"for",
".",
"pb",
"files",
"and",
"evaluate"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/imports/tensorflow/TensorFlowImportValidator.java#L39-L54 |
128,485 | deeplearning4j/deeplearning4j | nd4j/nd4j-serde/nd4j-grpc/src/main/java/org/nd4j/graph/GraphInferenceGrpcClient.java | GraphInferenceGrpcClient.output | public <T> T output(long graphId, T value, OperandsAdapter<T> adapter) {
return adapter.output(this.output(graphId, adapter.input(value)));
} | java | public <T> T output(long graphId, T value, OperandsAdapter<T> adapter) {
return adapter.output(this.output(graphId, adapter.input(value)));
} | [
"public",
"<",
"T",
">",
"T",
"output",
"(",
"long",
"graphId",
",",
"T",
"value",
",",
"OperandsAdapter",
"<",
"T",
">",
"adapter",
")",
"{",
"return",
"adapter",
".",
"output",
"(",
"this",
".",
"output",
"(",
"graphId",
",",
"adapter",
".",
"input... | This method is suited for use of custom OperandsAdapters
@param adapter
@param <T>
@return | [
"This",
"method",
"is",
"suited",
"for",
"use",
"of",
"custom",
"OperandsAdapters"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-serde/nd4j-grpc/src/main/java/org/nd4j/graph/GraphInferenceGrpcClient.java#L127-L129 |
128,486 | deeplearning4j/deeplearning4j | nd4j/nd4j-serde/nd4j-grpc/src/main/java/org/nd4j/graph/GraphInferenceGrpcClient.java | GraphInferenceGrpcClient.output | public INDArray[] output(long graphId, Pair<String, INDArray>... inputs) {
val operands = new Operands();
for (val in:inputs)
operands.addArgument(in.getFirst(), in.getSecond());
return output(graphId, operands).asArray();
} | java | public INDArray[] output(long graphId, Pair<String, INDArray>... inputs) {
val operands = new Operands();
for (val in:inputs)
operands.addArgument(in.getFirst(), in.getSecond());
return output(graphId, operands).asArray();
} | [
"public",
"INDArray",
"[",
"]",
"output",
"(",
"long",
"graphId",
",",
"Pair",
"<",
"String",
",",
"INDArray",
">",
"...",
"inputs",
")",
"{",
"val",
"operands",
"=",
"new",
"Operands",
"(",
")",
";",
"for",
"(",
"val",
"in",
":",
"inputs",
")",
"o... | This method sends inference request to the GraphServer instance, and returns result as array of INDArrays
@param graphId id of the graph
@param inputs graph inputs with their string ides
@return | [
"This",
"method",
"sends",
"inference",
"request",
"to",
"the",
"GraphServer",
"instance",
"and",
"returns",
"result",
"as",
"array",
"of",
"INDArrays"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-serde/nd4j-grpc/src/main/java/org/nd4j/graph/GraphInferenceGrpcClient.java#L183-L189 |
128,487 | deeplearning4j/deeplearning4j | nd4j/nd4j-serde/nd4j-grpc/src/main/java/org/nd4j/graph/GraphInferenceGrpcClient.java | GraphInferenceGrpcClient.dropGraph | public void dropGraph(long graphId) {
val builder = new FlatBufferBuilder(128);
val off = FlatDropRequest.createFlatDropRequest(builder, graphId);
builder.finish(off);
val req = FlatDropRequest.getRootAsFlatDropRequest(builder.dataBuffer());
val v = blockingStub.forgetGraph(re... | java | public void dropGraph(long graphId) {
val builder = new FlatBufferBuilder(128);
val off = FlatDropRequest.createFlatDropRequest(builder, graphId);
builder.finish(off);
val req = FlatDropRequest.getRootAsFlatDropRequest(builder.dataBuffer());
val v = blockingStub.forgetGraph(re... | [
"public",
"void",
"dropGraph",
"(",
"long",
"graphId",
")",
"{",
"val",
"builder",
"=",
"new",
"FlatBufferBuilder",
"(",
"128",
")",
";",
"val",
"off",
"=",
"FlatDropRequest",
".",
"createFlatDropRequest",
"(",
"builder",
",",
"graphId",
")",
";",
"builder",... | This method allows to remove graph from the GraphServer instance
@param graphId | [
"This",
"method",
"allows",
"to",
"remove",
"graph",
"from",
"the",
"GraphServer",
"instance"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-serde/nd4j-grpc/src/main/java/org/nd4j/graph/GraphInferenceGrpcClient.java#L195-L206 |
128,488 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/time/TimeSourceProvider.java | TimeSourceProvider.getInstance | public static TimeSource getInstance(String className) {
try {
Class<?> c = Class.forName(className);
Method m = c.getMethod("getInstance");
return (TimeSource) m.invoke(null);
} catch (Exception e) {
throw new RuntimeException("Error getting TimeSource in... | java | public static TimeSource getInstance(String className) {
try {
Class<?> c = Class.forName(className);
Method m = c.getMethod("getInstance");
return (TimeSource) m.invoke(null);
} catch (Exception e) {
throw new RuntimeException("Error getting TimeSource in... | [
"public",
"static",
"TimeSource",
"getInstance",
"(",
"String",
"className",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"c",
"=",
"Class",
".",
"forName",
"(",
"className",
")",
";",
"Method",
"m",
"=",
"c",
".",
"getMethod",
"(",
"\"getInstance\"",
... | Get a specific TimeSource by class name
@param className Class name of the TimeSource to return the instance for
@return TimeSource instance | [
"Get",
"a",
"specific",
"TimeSource",
"by",
"class",
"name"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/time/TimeSourceProvider.java#L63-L71 |
128,489 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ConvolutionUtils.java | ConvolutionUtils.getDeconvolutionOutputSize | public static int[] getDeconvolutionOutputSize(INDArray inputData, int[] kernel, int[] strides, int[] padding,
ConvolutionMode convolutionMode, int[] dilation) {
// FIXME: int cast
int hIn = (int) inputData.size(2);
int wIn = (int) inputData.si... | java | public static int[] getDeconvolutionOutputSize(INDArray inputData, int[] kernel, int[] strides, int[] padding,
ConvolutionMode convolutionMode, int[] dilation) {
// FIXME: int cast
int hIn = (int) inputData.size(2);
int wIn = (int) inputData.si... | [
"public",
"static",
"int",
"[",
"]",
"getDeconvolutionOutputSize",
"(",
"INDArray",
"inputData",
",",
"int",
"[",
"]",
"kernel",
",",
"int",
"[",
"]",
"strides",
",",
"int",
"[",
"]",
"padding",
",",
"ConvolutionMode",
"convolutionMode",
",",
"int",
"[",
"... | Get the output size of a deconvolution operation for given input data. In deconvolution, we compute the inverse
of the shape computation of a convolution.
@param inputData Input data
@param kernel Kernel size (height/width)
@param strides Strides (height/width)
@param padding Padding (he... | [
"Get",
"the",
"output",
"size",
"of",
"a",
"deconvolution",
"operation",
"for",
"given",
"input",
"data",
".",
"In",
"deconvolution",
"we",
"compute",
"the",
"inverse",
"of",
"the",
"shape",
"computation",
"of",
"a",
"convolution",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ConvolutionUtils.java#L72-L90 |
128,490 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ConvolutionUtils.java | ConvolutionUtils.getHeightAndWidth | public static int[] getHeightAndWidth(NeuralNetConfiguration conf) {
return getHeightAndWidth(
((org.deeplearning4j.nn.conf.layers.ConvolutionLayer) conf.getLayer()).getKernelSize());
} | java | public static int[] getHeightAndWidth(NeuralNetConfiguration conf) {
return getHeightAndWidth(
((org.deeplearning4j.nn.conf.layers.ConvolutionLayer) conf.getLayer()).getKernelSize());
} | [
"public",
"static",
"int",
"[",
"]",
"getHeightAndWidth",
"(",
"NeuralNetConfiguration",
"conf",
")",
"{",
"return",
"getHeightAndWidth",
"(",
"(",
"(",
"org",
".",
"deeplearning4j",
".",
"nn",
".",
"conf",
".",
"layers",
".",
"ConvolutionLayer",
")",
"conf",
... | Get the height and width
from the configuration
@param conf the configuration to get height and width from
@return the configuration to get height and width from | [
"Get",
"the",
"height",
"and",
"width",
"from",
"the",
"configuration"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ConvolutionUtils.java#L338-L341 |
128,491 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ConvolutionUtils.java | ConvolutionUtils.getHeightAndWidth | public static int[] getHeightAndWidth(int[] shape) {
if (shape.length < 2)
throw new IllegalArgumentException("No width and height able to be found: array must be at least length 2");
return new int[]{shape[shape.length - 1], shape[shape.length - 2]};
} | java | public static int[] getHeightAndWidth(int[] shape) {
if (shape.length < 2)
throw new IllegalArgumentException("No width and height able to be found: array must be at least length 2");
return new int[]{shape[shape.length - 1], shape[shape.length - 2]};
} | [
"public",
"static",
"int",
"[",
"]",
"getHeightAndWidth",
"(",
"int",
"[",
"]",
"shape",
")",
"{",
"if",
"(",
"shape",
".",
"length",
"<",
"2",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"No width and height able to be found: array must be at least leng... | Get the height and width
for an image
@param shape the shape of the image
@return the height and width for the image | [
"Get",
"the",
"height",
"and",
"width",
"for",
"an",
"image"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ConvolutionUtils.java#L360-L364 |
128,492 | deeplearning4j/deeplearning4j | nd4j/nd4j-tensorflow/src/main/java/org/nd4j/tensorflow/conversion/ProtoBufToFlatBufConversion.java | ProtoBufToFlatBufConversion.convert | public static void convert(String inFile, String outFile)
throws IOException, org.nd4j.linalg.exception.ND4JIllegalStateException {
SameDiff tg = TFGraphMapper.getInstance().importGraph(new File(inFile));
tg.asFlatFile(new File(outFile));
} | java | public static void convert(String inFile, String outFile)
throws IOException, org.nd4j.linalg.exception.ND4JIllegalStateException {
SameDiff tg = TFGraphMapper.getInstance().importGraph(new File(inFile));
tg.asFlatFile(new File(outFile));
} | [
"public",
"static",
"void",
"convert",
"(",
"String",
"inFile",
",",
"String",
"outFile",
")",
"throws",
"IOException",
",",
"org",
".",
"nd4j",
".",
"linalg",
".",
"exception",
".",
"ND4JIllegalStateException",
"{",
"SameDiff",
"tg",
"=",
"TFGraphMapper",
"."... | Converts a file containing a model from the Protocol Buffer format to the Flat
Buffer format.
@param inFile input file (.pb format)
@param outFile output file (.fb format)
@throws IOException
@throws org.nd4j.linalg.exception.ND4JIllegalStateException | [
"Converts",
"a",
"file",
"containing",
"a",
"model",
"from",
"the",
"Protocol",
"Buffer",
"format",
"to",
"the",
"Flat",
"Buffer",
"format",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-tensorflow/src/main/java/org/nd4j/tensorflow/conversion/ProtoBufToFlatBufConversion.java#L57-L61 |
128,493 | deeplearning4j/deeplearning4j | nd4j/nd4j-tensorflow/src/main/java/org/nd4j/tensorflow/conversion/ProtoBufToFlatBufConversion.java | ProtoBufToFlatBufConversion.convertBERT | public static void convertBERT(String inFile, String outFile)
throws IOException, org.nd4j.linalg.exception.ND4JIllegalStateException {
//
// Working around some issues in the BERT model's execution. See file:
// nd4j/nd4j-backends/nd4j-tests/src/test/java/org/nd4j/imports/TF... | java | public static void convertBERT(String inFile, String outFile)
throws IOException, org.nd4j.linalg.exception.ND4JIllegalStateException {
//
// Working around some issues in the BERT model's execution. See file:
// nd4j/nd4j-backends/nd4j-tests/src/test/java/org/nd4j/imports/TF... | [
"public",
"static",
"void",
"convertBERT",
"(",
"String",
"inFile",
",",
"String",
"outFile",
")",
"throws",
"IOException",
",",
"org",
".",
"nd4j",
".",
"linalg",
".",
"exception",
".",
"ND4JIllegalStateException",
"{",
"//",
"// Working around some issues in the B... | Converts a BERT model from the Protocol Buffer format to the Flat Buffer format.
@param inFile input file (.pb format)
@param outFile output file (.fb format)
@throws IOException
@throws org.nd4j.linalg.exception.ND4JIllegalStateException | [
"Converts",
"a",
"BERT",
"model",
"from",
"the",
"Protocol",
"Buffer",
"format",
"to",
"the",
"Flat",
"Buffer",
"format",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-tensorflow/src/main/java/org/nd4j/tensorflow/conversion/ProtoBufToFlatBufConversion.java#L70-L155 |
128,494 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/BooleanIndexing.java | BooleanIndexing.and | public static boolean and(final INDArray n, final Condition cond) {
if (cond instanceof BaseCondition) {
long val = (long) Nd4j.getExecutioner().exec(new MatchCondition(n, cond)).getDouble(0);
if (val == n.length())
return true;
else
return fa... | java | public static boolean and(final INDArray n, final Condition cond) {
if (cond instanceof BaseCondition) {
long val = (long) Nd4j.getExecutioner().exec(new MatchCondition(n, cond)).getDouble(0);
if (val == n.length())
return true;
else
return fa... | [
"public",
"static",
"boolean",
"and",
"(",
"final",
"INDArray",
"n",
",",
"final",
"Condition",
"cond",
")",
"{",
"if",
"(",
"cond",
"instanceof",
"BaseCondition",
")",
"{",
"long",
"val",
"=",
"(",
"long",
")",
"Nd4j",
".",
"getExecutioner",
"(",
")",
... | And over the whole ndarray given some condition
@param n the ndarray to test
@param cond the condition to test against
@return true if all of the elements meet the specified
condition false otherwise | [
"And",
"over",
"the",
"whole",
"ndarray",
"given",
"some",
"condition"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/BooleanIndexing.java#L50-L62 |
128,495 | deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/BooleanIndexing.java | BooleanIndexing.lastIndex | public static INDArray lastIndex(INDArray array, Condition condition) {
if (!(condition instanceof BaseCondition))
throw new UnsupportedOperationException("Only static Conditions are supported");
LastIndex idx = new LastIndex(array, condition);
Nd4j.getExecutioner().exec(idx);
... | java | public static INDArray lastIndex(INDArray array, Condition condition) {
if (!(condition instanceof BaseCondition))
throw new UnsupportedOperationException("Only static Conditions are supported");
LastIndex idx = new LastIndex(array, condition);
Nd4j.getExecutioner().exec(idx);
... | [
"public",
"static",
"INDArray",
"lastIndex",
"(",
"INDArray",
"array",
",",
"Condition",
"condition",
")",
"{",
"if",
"(",
"!",
"(",
"condition",
"instanceof",
"BaseCondition",
")",
")",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Only static Conditions... | This method returns last index matching given condition
PLEASE NOTE: This method will return -1 value if condition wasn't met
@param array
@param condition
@return | [
"This",
"method",
"returns",
"last",
"index",
"matching",
"given",
"condition"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/indexing/BooleanIndexing.java#L315-L322 |
128,496 | deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/mnist/MnistManager.java | MnistManager.writeImageToPpm | public static void writeImageToPpm(int[][] image, String ppmFileName) throws IOException {
try (BufferedWriter ppmOut = new BufferedWriter(new FileWriter(ppmFileName))) {
int rows = image.length;
int cols = image[0].length;
ppmOut.write("P3\n");
ppmOut.write("" + ... | java | public static void writeImageToPpm(int[][] image, String ppmFileName) throws IOException {
try (BufferedWriter ppmOut = new BufferedWriter(new FileWriter(ppmFileName))) {
int rows = image.length;
int cols = image[0].length;
ppmOut.write("P3\n");
ppmOut.write("" + ... | [
"public",
"static",
"void",
"writeImageToPpm",
"(",
"int",
"[",
"]",
"[",
"]",
"image",
",",
"String",
"ppmFileName",
")",
"throws",
"IOException",
"{",
"try",
"(",
"BufferedWriter",
"ppmOut",
"=",
"new",
"BufferedWriter",
"(",
"new",
"FileWriter",
"(",
"ppm... | Writes the given image in the given file using the PPM data format.
@param image
@param ppmFileName
@throws java.io.IOException | [
"Writes",
"the",
"given",
"image",
"in",
"the",
"given",
"file",
"using",
"the",
"PPM",
"data",
"format",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/mnist/MnistManager.java#L54-L69 |
128,497 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-util/src/main/java/org/deeplearning4j/util/MovingWindowMatrix.java | MovingWindowMatrix.windows | public List<INDArray> windows(boolean flattened) {
List<INDArray> ret = new ArrayList<>();
int window = 0;
for (int i = 0; i < toSlice.length(); i++) {
if (window >= toSlice.length())
break;
double[] w = new double[this.windowRowSize * this.windowColumnSi... | java | public List<INDArray> windows(boolean flattened) {
List<INDArray> ret = new ArrayList<>();
int window = 0;
for (int i = 0; i < toSlice.length(); i++) {
if (window >= toSlice.length())
break;
double[] w = new double[this.windowRowSize * this.windowColumnSi... | [
"public",
"List",
"<",
"INDArray",
">",
"windows",
"(",
"boolean",
"flattened",
")",
"{",
"List",
"<",
"INDArray",
">",
"ret",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"int",
"window",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i... | Moving window, capture a row x column moving window of
a given matrix
@param flattened whether the arrays should be flattened or not
@return the list of moving windows | [
"Moving",
"window",
"capture",
"a",
"row",
"x",
"column",
"moving",
"window",
"of",
"a",
"given",
"matrix"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-util/src/main/java/org/deeplearning4j/util/MovingWindowMatrix.java#L87-L119 |
128,498 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-data/deeplearning4j-datasets/src/main/java/org/deeplearning4j/datasets/iterator/impl/EmnistDataSetIterator.java | EmnistDataSetIterator.numExamplesTrain | public static int numExamplesTrain(Set dataSet) {
switch (dataSet) {
case COMPLETE:
return NUM_COMPLETE_TRAIN;
case MERGE:
return NUM_MERGE_TRAIN;
case BALANCED:
return NUM_BALANCED_TRAIN;
case LETTERS:
... | java | public static int numExamplesTrain(Set dataSet) {
switch (dataSet) {
case COMPLETE:
return NUM_COMPLETE_TRAIN;
case MERGE:
return NUM_MERGE_TRAIN;
case BALANCED:
return NUM_BALANCED_TRAIN;
case LETTERS:
... | [
"public",
"static",
"int",
"numExamplesTrain",
"(",
"Set",
"dataSet",
")",
"{",
"switch",
"(",
"dataSet",
")",
"{",
"case",
"COMPLETE",
":",
"return",
"NUM_COMPLETE_TRAIN",
";",
"case",
"MERGE",
":",
"return",
"NUM_MERGE_TRAIN",
";",
"case",
"BALANCED",
":",
... | Get the number of training examples for the specified subset
@param dataSet Subset to get
@return Number of examples for the specified subset | [
"Get",
"the",
"number",
"of",
"training",
"examples",
"for",
"the",
"specified",
"subset"
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-data/deeplearning4j-datasets/src/main/java/org/deeplearning4j/datasets/iterator/impl/EmnistDataSetIterator.java#L154-L171 |
128,499 | deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-data/deeplearning4j-datasets/src/main/java/org/deeplearning4j/datasets/iterator/impl/EmnistDataSetIterator.java | EmnistDataSetIterator.getLabelsArray | public static char[] getLabelsArray(Set dataSet) {
switch (dataSet) {
case COMPLETE:
return LABELS_COMPLETE;
case MERGE:
return LABELS_MERGE;
case BALANCED:
return LABELS_BALANCED;
case LETTERS:
retur... | java | public static char[] getLabelsArray(Set dataSet) {
switch (dataSet) {
case COMPLETE:
return LABELS_COMPLETE;
case MERGE:
return LABELS_MERGE;
case BALANCED:
return LABELS_BALANCED;
case LETTERS:
retur... | [
"public",
"static",
"char",
"[",
"]",
"getLabelsArray",
"(",
"Set",
"dataSet",
")",
"{",
"switch",
"(",
"dataSet",
")",
"{",
"case",
"COMPLETE",
":",
"return",
"LABELS_COMPLETE",
";",
"case",
"MERGE",
":",
"return",
"LABELS_MERGE",
";",
"case",
"BALANCED",
... | Get the label assignments for the given set as a character array.
@param dataSet DataSet to get the label assignment for
@return Label assignment and given dataset | [
"Get",
"the",
"label",
"assignments",
"for",
"the",
"given",
"set",
"as",
"a",
"character",
"array",
"."
] | effce52f2afd7eeb53c5bcca699fcd90bd06822f | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-data/deeplearning4j-datasets/src/main/java/org/deeplearning4j/datasets/iterator/impl/EmnistDataSetIterator.java#L247-L263 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.