|
1 |
| -/* Copyright 2019-2021 The TensorFlow Authors. All Rights Reserved. |
| 1 | +/* Copyright 2019-2022 The TensorFlow Authors. All Rights Reserved. |
2 | 2 |
|
3 | 3 | Licensed under the Apache License, Version 2.0 (the "License");
|
4 | 4 | you may not use this file except in compliance with the License.
|
|
20 | 20 | import static org.tensorflow.internal.c_api.global.tensorflow.TF_GetAllOpList;
|
21 | 21 | import static org.tensorflow.internal.c_api.global.tensorflow.TF_GetOpList;
|
22 | 22 | import static org.tensorflow.internal.c_api.global.tensorflow.TF_LoadLibrary;
|
| 23 | +import static org.tensorflow.internal.c_api.global.tensorflow.TF_RegisterFilesystemPlugin; |
23 | 24 | import static org.tensorflow.internal.c_api.global.tensorflow.TF_Version;
|
24 | 25 |
|
25 | 26 | import com.google.protobuf.InvalidProtocolBufferException;
|
@@ -108,6 +109,21 @@ public static OpList loadLibrary(String filename) {
|
108 | 109 | }
|
109 | 110 | }
|
110 | 111 |
|
| 112 | + /** |
| 113 | + * Loads the filesystem plugin from filename and registers all the filesystems it supports. |
| 114 | + * |
| 115 | + * <p>Throws a TF runtime exception if the plugin failed to load. |
| 116 | + * |
| 117 | + * @param filename Path of the dynamic library containing the filesystem support. |
| 118 | + */ |
| 119 | + public static void registerFilesystemPlugin(String filename) { |
| 120 | + try (PointerScope scope = new PointerScope()) { |
| 121 | + TF_Status status = TF_Status.newStatus(); |
| 122 | + TF_RegisterFilesystemPlugin(filename, status); |
| 123 | + status.throwExceptionIfNotOK(); |
| 124 | + } |
| 125 | + } |
| 126 | + |
111 | 127 | private static TF_Library libraryLoad(String filename) {
|
112 | 128 | try (PointerScope scope = new PointerScope()) {
|
113 | 129 | TF_Status status = TF_Status.newStatus();
|
|
0 commit comments