Skip to content

Commit bfe821a

Browse files
committed
Add header file for windows stub to enable pluggable device support.
1 parent e95d590 commit bfe821a

File tree

3 files changed

+36
-7
lines changed

3 files changed

+36
-7
lines changed

tensorflow-core/tensorflow-core-native/src/main/java/org/tensorflow/internal/c_api/presets/tensorflow.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019-2021 The TensorFlow Authors. All Rights Reserved.
2+
Copyright 2019-2025 The TensorFlow Authors. All Rights Reserved.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -53,6 +53,10 @@
5353
"tensorflow/c/eager/c_api_experimental.h",
5454
"tensorflow/c/c_api_experimental.h",
5555

56+
// Include the Windows-specific stub for TFE_GetServerDef to enable pluggable
57+
// device support.
58+
"tfe_serverdef_stub.h",
59+
5660
// Following are C API extensions maintained within TF Java, see src/main/native.
5761
// Binding directly the C++ API with JavaCPP turned out to be too precarious between
5862
// different releases,
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* Copyright 2025 The TensorFlow Authors. All Rights Reserved.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
provided under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
==============================================================================*/
15+
16+
#ifndef TENSORFLOW_JAVA_TFE_SERVERDEF_STUB_H_
17+
#define TENSORFLOW_JAVA_TFE_SERVERDEF_STUB_H_
18+
19+
#ifdef _WIN32
20+
21+
#include "tensorflow/c/c_api.h"
22+
#include "tensorflow/c/c_api_experimental.h"
23+
24+
// Include the implementation so that a local definition is always available
25+
// on Windows.
26+
#include "tfe_serverdef_stub.cc"
27+
28+
#endif // _WIN32
29+
30+
#endif // TENSORFLOW_JAVA_TFE_SERVERDEF_STUB_H_

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2025 The TensorFlow Authors. All Rights Reserved.
1+
/* Copyright 2024 The TensorFlow Authors. All Rights Reserved.
22
33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.
@@ -30,9 +30,4 @@ TF_CAPI_EXPORT extern void TFJ_UnmapOperationName(TF_Graph* g, TF_Operation* ope
3030

3131
#include "tfj_graph_impl.cc" // include CC file in its header to compile it with JavaCPP
3232

33-
#ifdef _WIN32
34-
// Ensure the Windows-specific stub for TFE_GetServerDef is linked.
35-
#include "tfe_serverdef_stub.cc"
36-
#endif
37-
3833
#endif // TENSORFLOW_JAVA_GRAPH_H_

0 commit comments

Comments
 (0)