code
stringlengths 11
173k
| docstring
stringlengths 2
593k
| func_name
stringlengths 2
189
| language
stringclasses 1
value | repo
stringclasses 844
values | path
stringlengths 11
294
| url
stringlengths 60
339
| license
stringclasses 4
values |
---|---|---|---|---|---|---|---|
public static StackTraceElement[] trimStackTrace(StackTraceElement[] stackTrace, List<StackTraceQuery> ignorePackages, List<StackTraceQuery> skipFullPatterns) {
if(skipFullPatterns != null && !skipFullPatterns.isEmpty()) {
if(StackTraceQuery.stackTraceFillsAnyCriteria(skipFullPatterns,stackTrace)) {
return new StackTraceElement[0];
}
}
if(ignorePackages != null && !ignorePackages.isEmpty()) {
StackTraceElement[] reverse = reverseCopy(stackTrace);
List<StackTraceElement> ret = new ArrayList<>();
//start backwards to find the index of the first non ignored package.
//we loop backwards to avoid typical unrelated boilerplate
//like unit tests or ide stack traces
int startingIndex = -1;
for(int i = 0; i < reverse.length; i++) {
if(!StackTraceQuery.stackTraceElementMatchesCriteria(ignorePackages,reverse[i],i)) {
startingIndex = i;
break;
}
}
//if we didn't find a match, just start at the beginning
if(startingIndex < 0) {
startingIndex = 0;
}
//loop backwards to present original stack trace
for(int i = reverse.length - 1; i >= startingIndex; i--) {
ret.add(reverse[i]);
}
return ret.toArray(new StackTraceElement[0]);
} else {
List<StackTraceElement> ret = new ArrayList<>();
for (StackTraceElement stackTraceElement : stackTrace) {
//note we break because it doesn't make sense to continue rendering when we've hit a package we should be ignoring.
//this allows a user to specify 1 namespace and ignore anything after it.
ret.add(stackTraceElement);
}
return ret.toArray(new StackTraceElement[0]);
}
} |
Returns a potentially reduced stacktrace
based on the namepsaces specified
in the ignore packages and
skipFullPatterns lists
@param stackTrace the stack trace to filter
@param ignorePackages the packages to ignore
@param skipFullPatterns the full patterns to skip
@return the filtered stack trace
| StackTraceUtils::trimStackTrace | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/util/StackTraceUtils.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/util/StackTraceUtils.java | Apache-2.0 |
public static String renderStackTrace(StackTraceElement[] stackTrace, List<StackTraceQuery> ignorePackages, List<StackTraceQuery> skipFullPatterns) {
StringBuilder stringBuilder = new StringBuilder();
StackTraceElement[] stackTrace1 = trimStackTrace(stackTrace,ignorePackages,skipFullPatterns);
for (StackTraceElement stackTraceElement : stackTrace1) {
stringBuilder.append(stackTraceElement.toString() + "\n");
}
return stringBuilder.toString();
} |
Get the current stack trace as a string.
@return
| StackTraceUtils::renderStackTrace | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/util/StackTraceUtils.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/util/StackTraceUtils.java | Apache-2.0 |
public static String renderStackTrace(StackTraceElement[] stackTrace) {
return renderStackTrace(stackTrace, null,null );
} |
Get the current stack trace as a string.
@return
| StackTraceUtils::renderStackTrace | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/util/StackTraceUtils.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/util/StackTraceUtils.java | Apache-2.0 |
public static String currentStackTraceString() {
Thread currentThread = Thread.currentThread();
StackTraceElement[] stackTrace = currentThread.getStackTrace();
return renderStackTrace(stackTrace);
} |
Get the current stack trace as a string.
@return
| StackTraceUtils::currentStackTraceString | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/util/StackTraceUtils.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/util/StackTraceUtils.java | Apache-2.0 |
public static Set<StackTraceElement> parentOfInvocation(StackTraceElement[] elements, StackTraceElement pointOfOrigin, StackTraceElement pointOfInvocation) {
if(elements == null || elements.length < 1)
return null;
int pointOfInvocationIndex = -1;
for(int i = 0; i < elements.length; i++) {
if(elements[i].equals(pointOfInvocation)) {
pointOfInvocationIndex = i;
break;
}
}
if(pointOfInvocationIndex <= 0) {
return new HashSet<>(Arrays.asList(elements));
}
if(pointOfInvocationIndex < 0)
throw new IllegalArgumentException("Invalid stack trace. Point of invocation not found!");
int pointOfOriginIndex = -1;
Set<StackTraceElement> ret = new HashSet<>();
//loop backwards to find the first non nd4j class
for(int i = pointOfInvocationIndex + 1; i < elements.length; i++) {
StackTraceElement element = elements[i];
if(!StackTraceQuery.stackTraceElementMatchesCriteria(invalidPointOfInvocationClasses,elements[i],i)
&& !StackTraceQuery.stackTraceElementMatchesCriteria(invalidPointOfInvocationPatterns,elements[i],i) &&
!element.getClassName().equals(pointOfOrigin.getClassName()) && !element.getClassName().equals(pointOfInvocation.getClassName())) {
pointOfOriginIndex = i;
break;
}
}
if(pointOfOriginIndex < 0) {
return new HashSet<>(Arrays.asList(elements));
}
//this is what we'll call the "interesting parents", we need to index
//by multiple parents in order to capture the different parts of the stack tree that could be applicable.
for(int i = pointOfOriginIndex; i < elements.length; i++) {
StackTraceElement element = elements[i];
if(StackTraceQuery.stackTraceElementMatchesCriteria(invalidPointOfInvocationClasses,elements[i],i)
|| StackTraceQuery.stackTraceElementMatchesCriteria(invalidPointOfInvocationPatterns,elements[i],i) ||
element.getClassName().equals(pointOfOrigin.getClassName()) || element.getClassName().equals(pointOfInvocation.getClassName())) {
break;
}
ret.add(elements[i]);
}
return ret;
} |
Parent of invocation is an element of the stack trace
with a different class altogether.
The goal is to be able to segment what is calling a method within the same class.
@param elements the elements to get the parent of invocation for
@return
| StackTraceUtils::parentOfInvocation | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/util/StackTraceUtils.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/util/StackTraceUtils.java | Apache-2.0 |
public static StackTraceElement[] callsFromClass(StackTraceElement[] elements, String className) {
if(elements == null || elements.length < 1)
return null;
List<StackTraceElement> ret = new ArrayList<>();
for(int i = 0; i < elements.length; i++) {
if(elements[i].getClassName().equals(className)) {
ret.add(elements[i]);
}
}
return ret.toArray(new StackTraceElement[0]);
} |
Calls from class is a method that returns
all stack trace elements that are from a given class.
@param elements the elements to get the calls from class for
@param className the class name to get the calls from
@return the stack trace elements from the given class
| StackTraceUtils::callsFromClass | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/util/StackTraceUtils.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/util/StackTraceUtils.java | Apache-2.0 |
public static StackTraceElement pointOfOrigin(StackTraceElement[] elements) {
if(elements == null || elements.length < 1)
return null;
int pointOfOriginIndex = 0;
//loop backwards to find the first non nd4j class
for(int i = elements.length - 1; i >= 0; i--) {
if(!StackTraceQuery.stackTraceElementMatchesCriteria(invalidPointOfInvocationClasses,elements[i],i)
&& !StackTraceQuery.stackTraceElementMatchesCriteria(invalidPointOfInvocationPatterns,elements[i],i)) {
pointOfOriginIndex = i;
break;
}
}
return elements[pointOfOriginIndex];
} |
Point of origin is the first non nd4j class in the stack trace.
@param elements the elements to get the point of origin for
@return
| StackTraceUtils::pointOfOrigin | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/util/StackTraceUtils.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/util/StackTraceUtils.java | Apache-2.0 |
public static StackTraceElement pointOfInvocation(StackTraceElement[] elements) {
if(elements == null || elements.length < 1)
return null;
int pointOfInvocationIndex = 0;
for(int i = 0; i < elements.length; i++) {
if(!StackTraceQuery.stackTraceElementMatchesCriteria(invalidPointOfInvocationClasses,elements[i],i)
&& !StackTraceQuery.stackTraceElementMatchesCriteria(invalidPointOfInvocationPatterns,elements[i],i)) {
pointOfInvocationIndex = i;
break;
}
}
return elements[pointOfInvocationIndex];
} |
@param elements
@return
| StackTraceUtils::pointOfInvocation | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/util/StackTraceUtils.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/util/StackTraceUtils.java | Apache-2.0 |
public static int countLines(InputStream is) throws IOException {
try {
byte[] c = new byte[1024];
int count = 0;
int readChars = 0;
boolean empty = true;
while ((readChars = is.read(c)) != -1) {
empty = false;
for (int i = 0; i < readChars; ++i) {
if (c[i] == '\n') {
++count;
}
}
}
return (count == 0 && !empty) ? 1 : count;
} finally {
is.close();
}
} |
Count number of lines in a file
@param is
@return
@throws IOException
| InputStreamUtil::countLines | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/util/InputStreamUtil.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/util/InputStreamUtil.java | Apache-2.0 |
public static int countLines(String filename) throws IOException {
FileInputStream fis = new FileInputStream(filename);
try {
return countLines(new BufferedInputStream(fis));
} finally {
fis.close();
}
} |
Count number of lines in a file
@param filename
@return
@throws IOException
| InputStreamUtil::countLines | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/util/InputStreamUtil.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/util/InputStreamUtil.java | Apache-2.0 |
public static ObjectMapper getJsonMapper() {
return objectMapper;
} |
Get a single object mapper for use
with reading and writing json
@return
| ObjectMapperHolder::getJsonMapper | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/holder/ObjectMapperHolder.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/holder/ObjectMapperHolder.java | Apache-2.0 |
public static <K,V> Map<K,Pair<List<V>,List<V>>> cogroup(List<Pair<K,V>> left,List<Pair<K,V>> right) {
Map<K,Pair<List<V>,List<V>>> ret = new HashMap<>();
//group by key first to consolidate values
Map<K,List<V>> leftMap = groupByKey(left);
Map<K,List<V>> rightMap = groupByKey(right);
/**
* Iterate over each key in the list
* adding values to the left items
* as values are found in the list.
*/
for(Map.Entry<K,List<V>> entry : leftMap.entrySet()) {
K key = entry.getKey();
if(!ret.containsKey(key)) {
List<V> leftListPair = new ArrayList<>();
List<V> rightListPair = new ArrayList<>();
Pair<List<V>,List<V>> p = Pair.of(leftListPair,rightListPair);
ret.put(key,p);
}
Pair<List<V>,List<V>> p = ret.get(key);
p.getFirst().addAll(entry.getValue());
}
/**
* Iterate over each key in the list
* adding values to the right items
* as values are found in the list.
*/
for(Map.Entry<K,List<V>> entry : rightMap.entrySet()) {
K key = entry.getKey();
if(!ret.containsKey(key)) {
List<V> leftListPair = new ArrayList<>();
List<V> rightListPair = new ArrayList<>();
Pair<List<V>,List<V>> p = Pair.of(leftListPair,rightListPair);
ret.put(key,p);
}
Pair<List<V>,List<V>> p = ret.get(key);
p.getSecond().addAll(entry.getValue());
}
return ret;
} |
For each key in left and right, cogroup returns the list of values
as a pair for each value present in left as well as right.
@param left the left list of pairs to join
@param right the right list of pairs to join
@param <K> the key type
@param <V> the value type
@return a map of the list of values by key for each value in the left as well as the right
with each element in the pair representing the values in left and right respectively.
| FunctionalUtils::cogroup | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/function/FunctionalUtils.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/function/FunctionalUtils.java | Apache-2.0 |
public static <K,V> Map<K,List<V>> groupByKey(List<Pair<K,V>> listInput) {
Map<K,List<V>> ret = new HashMap<>();
for(Pair<K,V> pair : listInput) {
List<V> currList = ret.get(pair.getFirst());
if(currList == null) {
currList = new ArrayList<>();
ret.put(pair.getFirst(),currList);
}
currList.add(pair.getSecond());
}
return ret;
} |
Group the input pairs by the key of each pair.
@param listInput the list of pairs to group
@param <K> the key type
@param <V> the value type
@return a map representing a grouping of the
keys by the given input key type and list of values
in the grouping.
| FunctionalUtils::groupByKey | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/function/FunctionalUtils.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/function/FunctionalUtils.java | Apache-2.0 |
public static <K,V> List<Pair<K,V>> mapToPair(Map<K,V> map) {
List<Pair<K,V>> ret = new ArrayList<>(map.size());
for(Map.Entry<K,V> entry : map.entrySet()) {
ret.add(Pair.of(entry.getKey(),entry.getValue()));
}
return ret;
} |
Convert a map with a set of entries of type K for key
and V for value in to a list of {@link Pair}
@param map the map to collapse
@param <K> the key type
@param <V> the value type
@return the collapsed map as a {@link List}
| FunctionalUtils::mapToPair | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/function/FunctionalUtils.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/function/FunctionalUtils.java | Apache-2.0 |
public static void checkArgument(boolean b) {
if (!b) {
throw new IllegalArgumentException();
}
} |
Check the specified boolean argument. Throws an IllegalArgumentException if {@code b} is false
@param b Argument to check
| Preconditions::checkArgument | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkArgument(boolean b, String message) {
if (!b) {
throwEx(message);
}
} |
Check the specified boolean argument. Throws an IllegalArgumentException with the specified message if {@code b} is false
@param b Argument to check
@param message Message for exception. May be null
| Preconditions::checkArgument | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkArgument(boolean b, String msg, int arg1) {
if (!b) {
throwEx(msg, arg1);
}
} |
See {@link #checkArgument(boolean, String, Object...)}
| Preconditions::checkArgument | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkArgument(boolean b, String msg, long arg1) {
if (!b) {
throwEx(msg, arg1);
}
} |
See {@link #checkArgument(boolean, String, Object...)}
| Preconditions::checkArgument | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkArgument(boolean b, String msg, double arg1) {
if (!b) {
throwEx(msg, arg1);
}
} |
See {@link #checkArgument(boolean, String, Object...)}
| Preconditions::checkArgument | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkArgument(boolean b, String msg, Object arg1) {
if (!b) {
throwEx(msg, arg1);
}
} |
See {@link #checkArgument(boolean, String, Object...)}
| Preconditions::checkArgument | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkArgument(boolean b, String msg, int arg1, int arg2) {
if (!b) {
throwEx(msg, arg1, arg2);
}
} |
See {@link #checkArgument(boolean, String, Object...)}
| Preconditions::checkArgument | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkArgument(boolean b, String msg, long arg1, long arg2) {
if (!b) {
throwEx(msg, arg1, arg2);
}
} |
See {@link #checkArgument(boolean, String, Object...)}
| Preconditions::checkArgument | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkArgument(boolean b, String msg, double arg1, double arg2) {
if (!b) {
throwEx(msg, arg1, arg2);
}
} |
See {@link #checkArgument(boolean, String, Object...)}
| Preconditions::checkArgument | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkArgument(boolean b, String msg, Object arg1, Object arg2) {
if (!b) {
throwEx(msg, arg1, arg2);
}
} |
See {@link #checkArgument(boolean, String, Object...)}
| Preconditions::checkArgument | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkArgument(boolean b, String msg, int arg1, int arg2, int arg3) {
if (!b) {
throwEx(msg, arg1, arg2, arg3);
}
} |
See {@link #checkArgument(boolean, String, Object...)}
| Preconditions::checkArgument | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkArgument(boolean b, String msg, long arg1, long arg2, long arg3) {
if (!b) {
throwEx(msg, arg1, arg2, arg3);
}
} |
See {@link #checkArgument(boolean, String, Object...)}
| Preconditions::checkArgument | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkArgument(boolean b, String msg, double arg1, double arg2, double arg3) {
if (!b) {
throwEx(msg, arg1, arg2, arg3);
}
} |
See {@link #checkArgument(boolean, String, Object...)}
| Preconditions::checkArgument | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkArgument(boolean b, String msg, Object arg1, Object arg2, Object arg3) {
if (!b) {
throwEx(msg, arg1, arg2, arg3);
}
} |
See {@link #checkArgument(boolean, String, Object...)}
| Preconditions::checkArgument | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkArgument(boolean b, String msg, int arg1, int arg2, int arg3, int arg4) {
if (!b) {
throwEx(msg, arg1, arg2, arg3, arg4);
}
} |
See {@link #checkArgument(boolean, String, Object...)}
| Preconditions::checkArgument | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkArgument(boolean b, String msg, long arg1, long arg2, long arg3, long arg4) {
if (!b) {
throwEx(msg, arg1, arg2, arg3, arg4);
}
} |
See {@link #checkArgument(boolean, String, Object...)}
| Preconditions::checkArgument | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkArgument(boolean b, String msg, double arg1, double arg2, double arg3, double arg4) {
if (!b) {
throwEx(msg, arg1, arg2, arg3, arg4);
}
} |
See {@link #checkArgument(boolean, String, Object...)}
| Preconditions::checkArgument | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkArgument(boolean b, String msg, Object arg1, Object arg2, Object arg3, Object arg4) {
if (!b) {
throwEx(msg, arg1, arg2, arg3, arg4);
}
} |
See {@link #checkArgument(boolean, String, Object...)}
| Preconditions::checkArgument | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkArgument(boolean b, String msg, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) {
if (!b) {
throwEx(msg, arg1, arg2, arg3, arg4, arg5);
}
} |
See {@link #checkArgument(boolean, String, Object...)}
| Preconditions::checkArgument | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkArgument(boolean b, String msg, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) {
if (!b) {
throwEx(msg, arg1, arg2, arg3, arg4, arg5, arg6);
}
} |
See {@link #checkArgument(boolean, String, Object...)}
| Preconditions::checkArgument | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkArgument(boolean b, String message, Object... args) {
if (!b) {
throwEx(message, args);
}
} |
Check the specified boolean argument. Throws an IllegalArgumentException with the specified message if {@code b} is false.
Note that the message may specify argument locations using "%s" - for example,
{@code checkArgument(false, "Got %s values, expected %s", 3, "more"} would throw an IllegalArgumentException
with the message "Got 3 values, expected more"
@param b Argument to check
@param message Message for exception. May be null.
@param args Arguments to place in message
| Preconditions::checkArgument | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkState(boolean b) {
if (!b) {
throw new IllegalStateException();
}
} |
Check the specified boolean argument. Throws an IllegalStateException if {@code b} is false
@param b State to check
| Preconditions::checkState | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkState(boolean b, String message) {
if (!b) {
throwStateEx(message);
}
} |
Check the specified boolean argument. Throws an IllegalStateException with the specified message if {@code b} is false
@param b State to check
@param message Message for exception. May be null
| Preconditions::checkState | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkState(boolean b, String msg, int arg1) {
if (!b) {
throwStateEx(msg, arg1);
}
} |
See {@link #checkState(boolean, String, Object...)}
| Preconditions::checkState | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkState(boolean b, String msg, long arg1) {
if (!b) {
throwStateEx(msg, arg1);
}
} |
See {@link #checkState(boolean, String, Object...)}
| Preconditions::checkState | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkState(boolean b, String msg, double arg1) {
if (!b) {
throwStateEx(msg, arg1);
}
} |
See {@link #checkState(boolean, String, Object...)}
| Preconditions::checkState | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkState(boolean b, String msg, Object arg1) {
if (!b) {
throwStateEx(msg, arg1);
}
} |
See {@link #checkState(boolean, String, Object...)}
| Preconditions::checkState | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkState(boolean b, String msg, int arg1, int arg2) {
if (!b) {
throwStateEx(msg, arg1, arg2);
}
} |
See {@link #checkState(boolean, String, Object...)}
| Preconditions::checkState | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkState(boolean b, String msg, long arg1, long arg2) {
if (!b) {
throwStateEx(msg, arg1, arg2);
}
} |
See {@link #checkState(boolean, String, Object...)}
| Preconditions::checkState | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkState(boolean b, String msg, double arg1, double arg2) {
if (!b) {
throwStateEx(msg, arg1, arg2);
}
} |
See {@link #checkState(boolean, String, Object...)}
| Preconditions::checkState | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkState(boolean b, String msg, Object arg1, Object arg2) {
if (!b) {
throwStateEx(msg, arg1, arg2);
}
} |
See {@link #checkState(boolean, String, Object...)}
| Preconditions::checkState | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkState(boolean b, String msg, int arg1, int arg2, int arg3) {
if (!b) {
throwStateEx(msg, arg1, arg2, arg3);
}
} |
See {@link #checkState(boolean, String, Object...)}
| Preconditions::checkState | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkState(boolean b, String msg, long arg1, long arg2, long arg3) {
if (!b) {
throwStateEx(msg, arg1, arg2, arg3);
}
} |
See {@link #checkState(boolean, String, Object...)}
| Preconditions::checkState | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkState(boolean b, String msg, double arg1, double arg2, double arg3) {
if (!b) {
throwStateEx(msg, arg1, arg2, arg3);
}
} |
See {@link #checkState(boolean, String, Object...)}
| Preconditions::checkState | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkState(boolean b, String msg, Object arg1, Object arg2, Object arg3) {
if (!b) {
throwStateEx(msg, arg1, arg2, arg3);
}
} |
See {@link #checkState(boolean, String, Object...)}
| Preconditions::checkState | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkState(boolean b, String msg, int arg1, int arg2, int arg3, int arg4) {
if (!b) {
throwStateEx(msg, arg1, arg2, arg3, arg4);
}
} |
See {@link #checkState(boolean, String, Object...)}
| Preconditions::checkState | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkState(boolean b, String msg, long arg1, long arg2, long arg3, long arg4) {
if (!b) {
throwStateEx(msg, arg1, arg2, arg3, arg4);
}
} |
See {@link #checkState(boolean, String, Object...)}
| Preconditions::checkState | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkState(boolean b, String msg, double arg1, double arg2, double arg3, double arg4) {
if (!b) {
throwStateEx(msg, arg1, arg2, arg3, arg4);
}
} |
See {@link #checkState(boolean, String, Object...)}
| Preconditions::checkState | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkState(boolean b, String msg, Object arg1, Object arg2, Object arg3, Object arg4) {
if (!b) {
throwStateEx(msg, arg1, arg2, arg3, arg4);
}
} |
See {@link #checkState(boolean, String, Object...)}
| Preconditions::checkState | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkState(boolean b, String msg, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5) {
if (!b) {
throwStateEx(msg, arg1, arg2, arg3, arg4, arg5);
}
} |
See {@link #checkState(boolean, String, Object...)}
| Preconditions::checkState | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkState(boolean b, String msg, Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Object arg6) {
if (!b) {
throwStateEx(msg, arg1, arg2, arg3, arg4, arg5, arg6);
}
} |
See {@link #checkState(boolean, String, Object...)}
| Preconditions::checkState | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkState(boolean b, String message, Object... args) {
if (!b) {
throwStateEx(message, args);
}
} |
Check the specified boolean argument. Throws an IllegalStateException with the specified message if {@code b} is false.
Note that the message may specify argument locations using "%s" - for example,
{@code checkArgument(false, "Got %s values, expected %s", 3, "more"} would throw an IllegalStateException
with the message "Got 3 values, expected more"
@param b Argument to check
@param message Message for exception. May be null.
@param args Arguments to place in message
| Preconditions::checkState | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkNotNull(Object o) {
if (o == null) {
throw new NullPointerException();
}
} |
Check the specified boolean argument. Throws an NullPointerException if {@code o} is false
@param o Object to check
| Preconditions::checkNotNull | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkNotNull(Object o, String message) {
if (o == null) {
throwNullPointerEx(message);
}
} |
Check the specified boolean argument. Throws an NullPointerException with the specified message if {@code o} is false
@param o Object to check
@param message Message for exception. May be null
| Preconditions::checkNotNull | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkNotNull(Object o, String msg, int arg1) {
if (o == null) {
throwNullPointerEx(msg, arg1);
}
} |
See {@link #checkNotNull(Object, String, Object...)}
| Preconditions::checkNotNull | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkNotNull(Object o, String msg, long arg1) {
if (o == null) {
throwNullPointerEx(msg, arg1);
}
} |
See {@link #checkNotNull(Object, String, Object...)}
| Preconditions::checkNotNull | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkNotNull(Object o, String msg, double arg1) {
if (o == null) {
throwNullPointerEx(msg, arg1);
}
} |
See {@link #checkNotNull(Object, String, Object...)}
| Preconditions::checkNotNull | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkNotNull(Object o, String msg, Object arg1) {
if (o == null) {
throwNullPointerEx(msg, arg1);
}
} |
See {@link #checkNotNull(Object, String, Object...)}
| Preconditions::checkNotNull | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkNotNull(Object o, String msg, int arg1, int arg2) {
if (o == null) {
throwNullPointerEx(msg, arg1, arg2);
}
} |
See {@link #checkNotNull(Object, String, Object...)}
| Preconditions::checkNotNull | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkNotNull(Object o, String msg, long arg1, long arg2) {
if (o == null) {
throwNullPointerEx(msg, arg1, arg2);
}
} |
See {@link #checkNotNull(Object, String, Object...)}
| Preconditions::checkNotNull | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkNotNull(Object o, String msg, double arg1, double arg2) {
if (o == null) {
throwNullPointerEx(msg, arg1, arg2);
}
} |
See {@link #checkNotNull(Object, String, Object...)}
| Preconditions::checkNotNull | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkNotNull(Object o, String msg, Object arg1, Object arg2) {
if (o == null) {
throwNullPointerEx(msg, arg1, arg2);
}
} |
See {@link #checkNotNull(Object, String, Object...)}
| Preconditions::checkNotNull | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkNotNull(Object o, String msg, int arg1, int arg2, int arg3) {
if (o == null) {
throwNullPointerEx(msg, arg1, arg2, arg3);
}
} |
See {@link #checkNotNull(Object, String, Object...)}
| Preconditions::checkNotNull | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkNotNull(Object o, String msg, long arg1, long arg2, long arg3) {
if (o == null) {
throwNullPointerEx(msg, arg1, arg2, arg3);
}
} |
See {@link #checkNotNull(Object, String, Object...)}
| Preconditions::checkNotNull | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkNotNull(Object o, String msg, double arg1, double arg2, double arg3) {
if (o == null) {
throwNullPointerEx(msg, arg1, arg2, arg3);
}
} |
See {@link #checkNotNull(Object, String, Object...)}
| Preconditions::checkNotNull | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkNotNull(Object o, String msg, Object arg1, Object arg2, Object arg3) {
if (o == null) {
throwNullPointerEx(msg, arg1, arg2, arg3);
}
} |
See {@link #checkNotNull(Object, String, Object...)}
| Preconditions::checkNotNull | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkNotNull(Object o, String msg, int arg1, int arg2, int arg3, int arg4) {
if (o == null) {
throwNullPointerEx(msg, arg1, arg2, arg3, arg4);
}
} |
See {@link #checkNotNull(Object, String, Object...)}
| Preconditions::checkNotNull | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkNotNull(Object o, String msg, long arg1, long arg2, long arg3, long arg4) {
if (o == null) {
throwNullPointerEx(msg, arg1, arg2, arg3, arg4);
}
} |
See {@link #checkNotNull(Object, String, Object...)}
| Preconditions::checkNotNull | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkNotNull(Object o, String msg, double arg1, double arg2, double arg3, double arg4) {
if (o == null) {
throwNullPointerEx(msg, arg1, arg2, arg3, arg4);
}
} |
See {@link #checkNotNull(Object, String, Object...)}
| Preconditions::checkNotNull | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkNotNull(Object o, String msg, Object arg1, Object arg2, Object arg3, Object arg4) {
if (o == null) {
throwNullPointerEx(msg, arg1, arg2, arg3, arg4);
}
} |
See {@link #checkNotNull(Object, String, Object...)}
| Preconditions::checkNotNull | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static void checkNotNull(Object o, String message, Object... args) {
if (o == null) {
throwStateEx(message, args);
}
} |
Check the specified boolean argument. Throws an IllegalStateException with the specified message if {@code o} is false.
Note that the message may specify argument locations using "%s" - for example,
{@code checkArgument(false, "Got %s values, expected %s", 3, "more"} would throw an IllegalStateException
with the message "Got 3 values, expected more"
@param o Object to check
@param message Message for exception. May be null.
@param args Arguments to place in message
| Preconditions::checkNotNull | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/base/Preconditions.java | Apache-2.0 |
public static FileBatch readFromZip(File file) throws IOException {
try (FileInputStream fis = new FileInputStream(file)) {
return readFromZip(fis);
}
} |
Read a FileBatch from the specified file. This method assumes the FileBatch was previously saved to
zip format using {@link #writeAsZip(File)} or {@link #writeAsZip(OutputStream)}
@param file File to read from
@return The loaded FileBatch
@throws IOException If an error occurs during reading
| FileBatch::readFromZip | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/loader/FileBatch.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/loader/FileBatch.java | Apache-2.0 |
public static FileBatch readFromZip(InputStream is) throws IOException {
String originalUris = null;
Map<Integer, byte[]> bytesMap = new HashMap<>();
try (ZipInputStream zis = new ZipInputStream(new BufferedInputStream(is))) {
ZipEntry ze;
while ((ze = zis.getNextEntry()) != null) {
String name = ze.getName();
byte[] bytes = IOUtils.toByteArray(zis);
if (name.equals(ORIGINAL_PATHS_FILENAME)) {
originalUris = new String(bytes, 0, bytes.length, StandardCharsets.UTF_8);
} else {
int idxSplit = name.indexOf("_");
int idxSplit2 = name.indexOf(".");
int fileIdx = Integer.parseInt(name.substring(idxSplit + 1, idxSplit2));
bytesMap.put(fileIdx, bytes);
}
}
}
List<byte[]> list = new ArrayList<>(bytesMap.size());
for (int i = 0; i < bytesMap.size(); i++) {
list.add(bytesMap.get(i));
}
List<String> origPaths = Arrays.asList(originalUris.split("\n"));
return new FileBatch(list, origPaths);
} |
Read a FileBatch from the specified input stream. This method assumes the FileBatch was previously saved to
zip format using {@link #writeAsZip(File)} or {@link #writeAsZip(OutputStream)}
@param is Input stream to read from
@return The loaded FileBatch
@throws IOException If an error occurs during reading
| FileBatch::readFromZip | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/loader/FileBatch.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/loader/FileBatch.java | Apache-2.0 |
public static FileBatch forFiles(File... files) throws IOException {
return forFiles(Arrays.asList(files));
} |
Create a FileBatch from the specified files
@param files Files to create the FileBatch from
@return The created FileBatch
@throws IOException If an error occurs during reading of the file content
| FileBatch::forFiles | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/loader/FileBatch.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/loader/FileBatch.java | Apache-2.0 |
public static FileBatch forFiles(List<File> files) throws IOException {
List<String> origPaths = new ArrayList<>(files.size());
List<byte[]> bytes = new ArrayList<>(files.size());
for (File f : files) {
bytes.add(FileUtils.readFileToByteArray(f));
origPaths.add(f.toURI().toString());
}
return new FileBatch(bytes, origPaths);
} |
Create a FileBatch from the specified files
@param files Files to create the FileBatch from
@return The created FileBatch
@throws IOException If an error occurs during reading of the file content
| FileBatch::forFiles | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/loader/FileBatch.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/loader/FileBatch.java | Apache-2.0 |
public void writeAsZip(File f) throws IOException {
writeAsZip(new FileOutputStream(f));
} |
Write the FileBatch to the specified File, in zip file format
@param f File to write to
@throws IOException If an error occurs during writing
| FileBatch::writeAsZip | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/loader/FileBatch.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/loader/FileBatch.java | Apache-2.0 |
public void writeAsZip(OutputStream os) throws IOException {
try (ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(os))) {
//Write original paths as a text file:
ZipEntry ze = new ZipEntry(ORIGINAL_PATHS_FILENAME);
String originalUrisJoined = StringUtils.join(originalUris, "\n"); //Java String.join is Java 8
zos.putNextEntry(ze);
zos.write(originalUrisJoined.getBytes(StandardCharsets.UTF_8));
for (int i = 0; i < fileBytes.size(); i++) {
String ext = FilenameUtils.getExtension(originalUris.get(i));
if (ext == null || ext.isEmpty())
ext = "bin";
String name = "file_" + i + "." + ext;
ze = new ZipEntry(name);
zos.putNextEntry(ze);
zos.write(fileBytes.get(i));
}
}
} |
@param os Write the FileBatch to the specified output stream, in zip file format
@throws IOException If an error occurs during writing
| FileBatch::writeAsZip | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/loader/FileBatch.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/loader/FileBatch.java | Apache-2.0 |
public CompactHeapStringList(int reallocationBlockSizeBytes, int intReallocationBlockSizeBytes) {
this.reallocationBlockSizeBytes = reallocationBlockSizeBytes;
this.reallocationIntegerBlockSizeBytes = intReallocationBlockSizeBytes;
this.data = new char[this.reallocationBlockSizeBytes / 2];
this.offsetAndLength = new int[this.reallocationIntegerBlockSizeBytes / 4];
} |
@param reallocationBlockSizeBytes Number of bytes by which to increase the char[], when allocating a new storage array
@param intReallocationBlockSizeBytes Number of bytes by which to increase the int[], when allocating a new storage array
| CompactHeapStringList::CompactHeapStringList | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/collection/CompactHeapStringList.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/collection/CompactHeapStringList.java | Apache-2.0 |
public static <K, T, V> MultiDimensionalMap<K, T, V> newThreadSafeTreeBackedMap() {
return new MultiDimensionalMap<>(new ConcurrentSkipListMap<Pair<K, T>, V>());
} |
Thread safe sorted map implementation
@param <K>
@param <T>
@param <V>
@return
| MultiDimensionalMap::newThreadSafeTreeBackedMap | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/collection/MultiDimensionalMap.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/collection/MultiDimensionalMap.java | Apache-2.0 |
public static <K, T, V> MultiDimensionalMap<K, T, V> newThreadSafeHashBackedMap() {
return new MultiDimensionalMap<>(new ConcurrentHashMap<Pair<K, T>, V>());
} |
Thread safe hash map implementation
@param <K>
@param <T>
@param <V>
@return
| MultiDimensionalMap::newThreadSafeHashBackedMap | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/collection/MultiDimensionalMap.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/collection/MultiDimensionalMap.java | Apache-2.0 |
public static <K, T, V> MultiDimensionalMap<K, T, V> newHashBackedMap() {
return new MultiDimensionalMap<>(new HashMap<Pair<K, T>, V>());
} |
Thread safe hash map impl
@param <K>
@param <T>
@param <V>
@return
| MultiDimensionalMap::newHashBackedMap | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/collection/MultiDimensionalMap.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/collection/MultiDimensionalMap.java | Apache-2.0 |
public static <K, T, V> MultiDimensionalMap<K, T, V> newTreeBackedMap() {
return new MultiDimensionalMap<>(new TreeMap<Pair<K, T>, V>());
} |
Tree map implementation
@param <K>
@param <T>
@param <V>
@return
| MultiDimensionalMap::newTreeBackedMap | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/collection/MultiDimensionalMap.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/collection/MultiDimensionalMap.java | Apache-2.0 |
public int size() {
return backedMap.size();
} |
Returns the number of key-value mappings in this map. If the
map contains more than <tt>Integer.MAX_VALUE</tt> elements, returns
<tt>Integer.MAX_VALUE</tt>.
@return the number of key-value mappings in this map
| MultiDimensionalMap::size | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/collection/MultiDimensionalMap.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/collection/MultiDimensionalMap.java | Apache-2.0 |
public boolean isEmpty() {
return backedMap.isEmpty();
} |
Returns <tt>true</tt> if this map contains no key-value mappings.
@return <tt>true</tt> if this map contains no key-value mappings
| MultiDimensionalMap::isEmpty | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/collection/MultiDimensionalMap.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/collection/MultiDimensionalMap.java | Apache-2.0 |
public File getTempFileFromArchive() throws IOException {
return getTempFileFromArchive(null);
} |
Get a temp file from the classpath.<br>
This is for resources where a file is needed and the classpath resource is in a jar file. The file is copied
to the default temporary directory, using {@link Files#createTempFile(String, String, FileAttribute[])}.
Consequently, the extracted file will have a different filename to the extracted one.
@return the temp file
@throws IOException If an error occurs when files are being copied
@see #getTempFileFromArchive(File)
| ClassPathResource::getTempFileFromArchive | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/io/ClassPathResource.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/io/ClassPathResource.java | Apache-2.0 |
public File getTempFileFromArchive(File rootDirectory) throws IOException {
InputStream is = getInputStream();
File tmpFile;
if(rootDirectory != null){
//Maintain original file names, as it's going in a directory...
tmpFile = new File(rootDirectory, FilenameUtils.getName(path));
} else {
tmpFile = Files.createTempFile(FilenameUtils.getName(path), "tmp").toFile();
}
tmpFile.deleteOnExit();
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(tmpFile));
IOUtils.copy(is, bos);
bos.flush();
bos.close();
return tmpFile;
} |
Get a temp file from the classpath, and (optionally) place it in the specified directory<br>
Note that:<br>
- If the directory is not specified, the file is copied to the default temporary directory, using
{@link Files#createTempFile(String, String, FileAttribute[])}. Consequently, the extracted file will have a
different filename to the extracted one.<br>
- If the directory *is* specified, the file is copied directly - and the original filename is maintained
@param rootDirectory May be null. If non-null, copy to the specified directory
@return the temp file
@throws IOException If an error occurs when files are being copied
@see #getTempFileFromArchive(File)
| ClassPathResource::getTempFileFromArchive | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/io/ClassPathResource.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/io/ClassPathResource.java | Apache-2.0 |
public void copyDirectory(File destination) throws IOException {
Preconditions.checkState(destination.exists() && destination.isDirectory(), "Destination directory must exist and be a directory: %s", destination);
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.
*/
InputStream stream = null;
ZipFile zipFile = null;
try {
GetStreamFromZip getStreamFromZip = new GetStreamFromZip(url, path).invoke();
ZipEntry entry = getStreamFromZip.getEntry();
stream = getStreamFromZip.getStream();
zipFile = getStreamFromZip.getZipFile();
Preconditions.checkState(entry.isDirectory(), "Source must be a directory: %s", entry.getName());
String pathNoSlash = this.path;
if(pathNoSlash.endsWith("/") || pathNoSlash.endsWith("\\")){
pathNoSlash = pathNoSlash.substring(0, pathNoSlash.length()-1);
}
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while(entries.hasMoreElements()){
ZipEntry e = entries.nextElement();
String name = e.getName();
if(name.startsWith(pathNoSlash) && name.length() > pathNoSlash.length() && (name.charAt(pathNoSlash.length()) == '/' || name.charAt(pathNoSlash.length()) == '\\')){ //second condition: to avoid "/dir/a/" and "/dir/abc/" both matching startsWith
String relativePath = name.substring(this.path.length());
File extractTo = new File(destination, relativePath);
if(e.isDirectory()){
extractTo.mkdirs();
} else {
try(BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(extractTo))){
InputStream is = getInputStream(name, clazz, classLoader);
IOUtils.copy(is, bos);
}
}
}
}
stream.close();
zipFile.close();
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
if(stream != null)
IOUtils.closeQuietly(stream);
if(zipFile != null)
IOUtils.closeQuietly(zipFile);
}
} else {
File source;
try{
source = new File(url.toURI());
} catch (URISyntaxException e) {
throw new IOException("Error converting URL to a URI - path may be invalid? Path=" + url);
}
Preconditions.checkState(source.isDirectory(), "Source must be a directory: %s", source);
Preconditions.checkState(destination.exists() && destination.isDirectory(), "Destination must be a directory and must exist: %s", destination);
FileUtils.copyDirectory(source, destination);
}
} |
Extract the directory recursively to the specified location. Current ClassPathResource must point to
a directory.<br>
For example, if classpathresource points to "some/dir/", then the contents - not including the parent directory "dir" -
will be extracted or copied to the specified destination.<br>
@param destination Destination directory. Must exist
| ClassPathResource::copyDirectory | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/io/ClassPathResource.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/io/ClassPathResource.java | Apache-2.0 |
private URL extractActualUrl(URL jarUrl) throws MalformedURLException {
String urlFile = jarUrl.getFile();
int separatorIndex = urlFile.indexOf("!/");
if (separatorIndex != -1) {
String jarFile = urlFile.substring(0, separatorIndex);
try {
return new URL(jarFile);
} catch (MalformedURLException var5) {
if (!jarFile.startsWith("/")) {
jarFile = "/" + jarFile;
}
return new URL("file:" + jarFile);
}
} else {
return jarUrl;
}
} |
Extracts parent Jar URL from original ClassPath entry URL.
@param jarUrl Original URL of the resource
@return URL of the Jar file, containing requested resource
@throws MalformedURLException
| GetStreamFromZip::extractActualUrl | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/common/io/ClassPathResource.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/io/ClassPathResource.java | Apache-2.0 |
public static List<StackTraceQuery> ofClassPatterns(boolean regex, String... classes) {
List<StackTraceQuery> ret = new ArrayList<>();
for (String s : classes) {
if(regex) {
cachedPatterns.put(s, Pattern.compile(s));
}
ret.add(StackTraceQuery.builder()
.regexMatch(regex)
.className(s).build());
}
return ret;
} |
Create a list of queries
based on the fully qualified class name patterns.
@param regex
@param classes the classes to create queries for
@return the list of queries
| StackTraceQuery::ofClassPatterns | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/linalg/profiler/data/stacktrace/StackTraceQuery.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/profiler/data/stacktrace/StackTraceQuery.java | Apache-2.0 |
public static boolean stackTraceFillsAnyCriteria(List<StackTraceQuery> queries, StackTraceElement[] stackTrace) {
if(stackTrace == null)
return false;
if(queries == null)
return false;
for (int j = 0; j < stackTrace.length; j++) {
StackTraceElement line = stackTrace[j];
//parse line like this: org.deeplearning4j.nn.layers.recurrent.BidirectionalLayer.backpropGradient(BidirectionalLayer.java:153)
if (stackTraceElementMatchesCriteria(queries, line, j)) return true;
}
return false;
} |
Returns true if the stack trace element matches the given criteria
@param queries the queries to match on
@param stackTrace the stack trace to match on
(note that the stack trace is in reverse order)
@return true if the stack trace element matches the given criteria
| StackTraceQuery::stackTraceFillsAnyCriteria | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/linalg/profiler/data/stacktrace/StackTraceQuery.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/profiler/data/stacktrace/StackTraceQuery.java | Apache-2.0 |
public static boolean stackTraceElementMatchesCriteria(List<StackTraceQuery> queries, StackTraceElement line, int j) {
if(queries == null || queries.isEmpty()) {
return false;
}
for (StackTraceQuery query : queries) {
//allow -1 on line number to mean any line number also allow methods that are unspecified to mean any method
//also check for the line count occurrence -1 means any
boolean classNameMatch = isClassNameMatch(query.getClassName(), query, line.getClassName());
//null or empty method name means any method name, depending on whether an exact match is required
//return we consider it a match
boolean methodNameMatch = isClassNameMatch(query.getMethodName(), query, line.getMethodName());
//< 0 line means any line number
boolean lineNumberMatch = query.getLineNumber() < 0 || query.getLineNumber() == line.getLineNumber();
//whether the user specifies if the match is within the stack trace depth. what this is for is
//to filter stack trace matches to a certain depth. for example, if you want to match a stack trace
//that occurs within a certain method, you can specify the depth of the stack trace to match on.
boolean matchesStackTraceDepth = (query.getOccursWithinLineCount() <= j || query.getOccursWithinLineCount() < 0);
boolean inLineRange = (query.getLineNumberBegin() <= line.getLineNumber() && query.getLineNumberEnd() >= line.getLineNumber()) || (query.getLineNumberBegin() < 0 && query.getLineNumberEnd() < 0);
if (classNameMatch
&& methodNameMatch
&& lineNumberMatch
&& inLineRange
&& matchesStackTraceDepth) {
return true;
}
}
return false;
} |
Returns true if the stack trace element matches the given criteria
@param queries the queries to match on
@param line the stack trace element to match on
@param j the index of the line
@return true if the stack trace element matches the given criteria
| StackTraceQuery::stackTraceElementMatchesCriteria | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/linalg/profiler/data/stacktrace/StackTraceQuery.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/profiler/data/stacktrace/StackTraceQuery.java | Apache-2.0 |
public boolean filter(StackTraceElement stackTraceElement) {
if (exclude != null && !exclude.isEmpty()) {
for (StackTraceQuery query : exclude) {
if (query.filter(stackTraceElement)) {
return true;
}
}
}
if (include != null && !include.isEmpty()) {
for (StackTraceQuery query : include) {
if (query.filter(stackTraceElement)) {
return false;
}
}
return false;
}
return false;
} |
Returns true if the stack trace element should be filtered
@param stackTraceElement the stack trace element to filter
@return true if the stack trace element should be filtered, false otherwise
| StackTraceQueryFilters::filter | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/linalg/profiler/data/stacktrace/StackTraceQueryFilters.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/profiler/data/stacktrace/StackTraceQueryFilters.java | Apache-2.0 |
public static boolean shouldFilter(StackTraceElement stackTraceElement[],
StackTraceQueryFilters stackTraceQueryFilters) {
if(stackTraceQueryFilters == null || stackTraceElement == null) {
return false;
}
for(StackTraceElement stackTraceElement1 : stackTraceElement) {
if(stackTraceElement1 == null)
continue;
if (stackTraceQueryFilters.filter(stackTraceElement1)) {
return true;
}
}
return false;
} |
Returns true if the stack trace element should be filtered
@param stackTraceElement the stack trace element to filter
@param stackTraceQueryFilters the filters to apply
@return true if the stack trace element should be filtered, false otherwise
| StackTraceQueryFilters::shouldFilter | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/linalg/profiler/data/stacktrace/StackTraceQueryFilters.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/profiler/data/stacktrace/StackTraceQueryFilters.java | Apache-2.0 |
public static boolean shouldFilter(StackTraceElement stackTraceElement,
StackTraceQueryFilters stackTraceQueryFilters) {
if(stackTraceQueryFilters == null || stackTraceElement == null)
return false;
return stackTraceQueryFilters.filter(stackTraceElement);
} |
Returns true if the stack trace element should be filtered
@param stackTraceElement the stack trace element to filter
@param stackTraceQueryFilters the filters to apply
@return
| StackTraceQueryFilters::shouldFilter | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/linalg/profiler/data/stacktrace/StackTraceQueryFilters.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/profiler/data/stacktrace/StackTraceQueryFilters.java | Apache-2.0 |
public static StackTraceElement lookup(StackTraceLookupKey key) {
if(!cache.containsKey(key)) {
storeStackTrace(Thread.currentThread().getStackTrace());
}
return cache.get(key);
} |
Lookup a stack trace element by key.
Note you can also directly use {@link #lookup(String, String, int)}
This method is mainly for use cases where you have to deal with multiple stack traces and it could be verbose.
Note that when looking up stack traces sometimes user space code can be missing.
If a cache entry is missing, we'll attempt to cache the current thread's stack trace elements.
Since user input is not guaranteed to be valid, we don't just dynamically create stack trace entries.
If your stack trace is missing, ensure you call {@link #storeStackTrace(StackTraceElement[])}
on your calling thread.
Usually this should be a transparent process included in certain constructors related to
the Environment's NDArray logging being set to true.
@param key the key to lookup
| StackTraceElementCache::lookup | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/linalg/profiler/data/stacktrace/StackTraceElementCache.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/profiler/data/stacktrace/StackTraceElementCache.java | Apache-2.0 |
public static Map<StackTraceLookupKey,StackTraceElement> getCache() {
return cache;
} |
Get the cache
@return the cache
| StackTraceElementCache::getCache | java | deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/linalg/profiler/data/stacktrace/StackTraceElementCache.java | https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/profiler/data/stacktrace/StackTraceElementCache.java | Apache-2.0 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.