Skip to content

Commit 224b911

Browse files
committed
Disable graph extension on Windows as well
1 parent 4d2f134 commit 224b911

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

tensorflow-core/tensorflow-core-native/src/main/native/org/tensorflow/internal/c_api/tfj_gradients.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ limitations under the License.
1919
#include "tfj_scope.h"
2020
#include "tensorflow/c/c_api.h"
2121

22-
#ifdef __cplusplus
2322
extern "C" {
24-
#endif
2523

2624
/// Function to be implemented on the JVM side to be called back by the native library when it is time to attach gradient operations for the given op, graph and scope.
2725
///
@@ -40,9 +38,8 @@ TF_CAPI_EXPORT extern bool TFJ_HasGradient(const char* op_type);
4038
/// Returns true if the function has been registered successfully, false if operation failed or if gradient function is already registered to that `op_type`.
4139
TF_CAPI_EXPORT extern bool TFJ_RegisterCustomGradient(const char* op_type, TFJ_GradFuncAdapter custom_gradient_adapter);
4240

43-
#ifdef __cplusplus
4441
} /* end extern "C" */
42+
4543
#include "tfj_gradients_impl.cc" // include CC file in its header to compile it with JavaCPP
46-
#endif
4744

4845
#endif // TENSORFLOW_JAVA_GRADIENTS_H_

tensorflow-core/tensorflow-core-native/src/main/native/org/tensorflow/internal/c_api/tfj_graph.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ limitations under the License.
1818

1919
#include "tensorflow/c/c_api.h"
2020

21-
#ifdef __cplusplus
2221
extern "C" {
23-
#endif
2422

2523
/// Unique identifier of a TensorFlow graph instance
2624
typedef void* TFJ_GraphId;
@@ -32,9 +30,8 @@ TF_CAPI_EXPORT extern TFJ_GraphId TFJ_GetGraphId(const TF_Graph* g);
3230
/// This is particularly useful for preventing custom gradient operations to pollute the graph namespace.
3331
TF_CAPI_EXPORT extern void TFJ_UnmapOperationName(TF_Graph* g, TF_Operation* operation);
3432

35-
#ifdef __cplusplus
3633
} /* end extern "C" */
34+
3735
#include "tfj_graph_impl.cc" // include CC file in its header to compile it with JavaCPP
38-
#endif
3936

4037
#endif // TENSORFLOW_JAVA_GRAPH_H_

tensorflow-core/tensorflow-core-native/src/main/native/org/tensorflow/internal/c_api/tfj_graph_impl.cc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
1515

16+
#ifndef _WIN32
17+
1618
#include "tensorflow/c/c_api_internal.h"
1719

1820
extern "C" {
@@ -28,3 +30,18 @@ void TFJ_UnmapOperationName(TF_Graph* g, TF_Operation* operation) {
2830
}
2931

3032
} /* end extern "C" */
33+
34+
#else // #indef _WIN32
35+
36+
/* This extension is not available on Windows */
37+
extern "C" {
38+
39+
TFJ_GraphId TFJ_GetGraphId(const TF_Graph* g) {
40+
return NULL;
41+
}
42+
43+
void TFJ_UnmapOperationName(TF_Graph* g, TF_Operation* operation) {}
44+
45+
} /* end extern "C" */
46+
47+
#endif // #indef _WIN32

tensorflow-core/tensorflow-core-native/src/main/native/org/tensorflow/internal/c_api/tfj_scope.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ limitations under the License.
1818

1919
#include "tensorflow/c/c_api.h"
2020

21-
#ifdef __cplusplus
2221
extern "C" {
23-
#endif
2422

2523
typedef struct TFJ_Scope TFJ_Scope;
2624

@@ -51,9 +49,8 @@ TF_CAPI_EXPORT extern TFJ_Scope TFJ_NewScopeWithDevice(const TFJ_Scope* scope, c
5149
/// Note: returns C++ std string to prevent buffer to be freed up before consuming the characters
5250
TF_CAPI_EXPORT extern std::string TFJ_GetUniqueNameForOp(const TFJ_Scope* scope, const char* default_name);
5351

54-
#ifdef __cplusplus
5552
} /* end extern "C" */
53+
5654
#include "tfj_scope_impl.cc" // include CC file in its header to compile it with JavaCPP
57-
#endif
5855

5956
#endif // TENSORFLOW_JAVA_SCOPE_H_

0 commit comments

Comments
 (0)