Log failure reason in TensorFlow.init()

This commit is contained in:
robert 2019-04-15 16:35:10 +01:00
parent 221a5146df
commit 9255ffe154

View File

@ -63,7 +63,19 @@ public final class TensorFlow {
/** Load the TensorFlow runtime C library. */
static void init() {
NativeLibrary.load();
try {
NativeLibrary.load();
} catch (Exception e) {
/*
* This code is called during static initialization of this and of other classes.
* If this fails then a NoClassDefFoundError is thrown however this does not
* include a cause. Printing the exception manually here ensures that the
* necessary information to fix the problem is available.
*/
System.err.println("Failed to load TensorFlow native library");
e.printStackTrace();
throw e;
}
}
static {