From 6f81d8f035e3e20418b77bccebbf7f6b0e775515 Mon Sep 17 00:00:00 2001 From: Adam Pocock Date: Fri, 19 Aug 2022 16:08:09 -0400 Subject: [PATCH 1/4] Adding a hook for loading TF IO native libraries. --- .../main/java/org/tensorflow/TensorFlow.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/TensorFlow.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/TensorFlow.java index 53748b82271..6fab8372c33 100644 --- a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/TensorFlow.java +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/TensorFlow.java @@ -1,4 +1,4 @@ -/* Copyright 2019-2021 The TensorFlow Authors. All Rights Reserved. +/* Copyright 2019-2022 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import static org.tensorflow.internal.c_api.global.tensorflow.TF_GetAllOpList; import static org.tensorflow.internal.c_api.global.tensorflow.TF_GetOpList; import static org.tensorflow.internal.c_api.global.tensorflow.TF_LoadLibrary; +import static org.tensorflow.internal.c_api.global.tensorflow.TF_RegisterFilesystemPlugin; import static org.tensorflow.internal.c_api.global.tensorflow.TF_Version; import com.google.protobuf.InvalidProtocolBufferException; @@ -108,6 +109,20 @@ public static OpList loadLibrary(String filename) { } } + /** + * Loads the filesystem plugin from fielname and registers all the filesystems it supports. + *

+ * Throws a TF runtime exception if the plugin failed to load. + * @param filename Path of the dynamic library containing the filesystem support. + */ + public static void registerFilesystemPlugin(String filename) { + try (PointerScope scope = new PointerScope()) { + TF_Status status = TF_Status.newStatus(); + TF_RegisterFilesystemPlugin(filename, status); + status.throwExceptionIfNotOK(); + } + } + private static TF_Library libraryLoad(String filename) { try (PointerScope scope = new PointerScope()) { TF_Status status = TF_Status.newStatus(); From 72332d2eac75ce5ab2fc672e0cd3048ee25063b4 Mon Sep 17 00:00:00 2001 From: Adam Pocock Date: Tue, 23 Aug 2022 10:31:38 -0400 Subject: [PATCH 2/4] Fixing the javadoc typo Fixing the javadoc typo. --- .../src/main/java/org/tensorflow/TensorFlow.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/TensorFlow.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/TensorFlow.java index 6fab8372c33..4f4ef950082 100644 --- a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/TensorFlow.java +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/TensorFlow.java @@ -110,7 +110,7 @@ public static OpList loadLibrary(String filename) { } /** - * Loads the filesystem plugin from fielname and registers all the filesystems it supports. + * Loads the filesystem plugin from filename and registers all the filesystems it supports. *

* Throws a TF runtime exception if the plugin failed to load. * @param filename Path of the dynamic library containing the filesystem support. From 8a7a2ce2ed8246d50f11cf933084e107e14ab713 Mon Sep 17 00:00:00 2001 From: Adam Pocock Date: Tue, 23 Aug 2022 10:45:06 -0400 Subject: [PATCH 3/4] Placating spotless --- .../src/main/java/org/tensorflow/TensorFlow.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/TensorFlow.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/TensorFlow.java index 4f4ef950082..f08c89d9660 100644 --- a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/TensorFlow.java +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/TensorFlow.java @@ -111,8 +111,8 @@ public static OpList loadLibrary(String filename) { /** * Loads the filesystem plugin from filename and registers all the filesystems it supports. - *

- * Throws a TF runtime exception if the plugin failed to load. + *

Throws a TF runtime exception if the plugin failed to load. + * * @param filename Path of the dynamic library containing the filesystem support. */ public static void registerFilesystemPlugin(String filename) { From 38eb6f3f655380306404d71757476b90d41e07f6 Mon Sep 17 00:00:00 2001 From: Adam Pocock Date: Tue, 23 Aug 2022 10:55:20 -0400 Subject: [PATCH 4/4] Placate spotless again Because it doesn't report all the errors at once. --- .../src/main/java/org/tensorflow/TensorFlow.java | 1 + 1 file changed, 1 insertion(+) diff --git a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/TensorFlow.java b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/TensorFlow.java index f08c89d9660..a25aa38c2f6 100644 --- a/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/TensorFlow.java +++ b/tensorflow-core/tensorflow-core-api/src/main/java/org/tensorflow/TensorFlow.java @@ -111,6 +111,7 @@ public static OpList loadLibrary(String filename) { /** * Loads the filesystem plugin from filename and registers all the filesystems it supports. + * *

Throws a TF runtime exception if the plugin failed to load. * * @param filename Path of the dynamic library containing the filesystem support.