Skip to content

Commit

Permalink
Disable graph extension on Windows as well
Browse files Browse the repository at this point in the history
  • Loading branch information
karllessard committed Feb 4, 2024
1 parent 4d2f134 commit 224b911
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ limitations under the License.
#include "tfj_scope.h"
#include "tensorflow/c/c_api.h"

#ifdef __cplusplus
extern "C" {
#endif

/// 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.
///
Expand All @@ -40,9 +38,8 @@ TF_CAPI_EXPORT extern bool TFJ_HasGradient(const char* op_type);
/// Returns true if the function has been registered successfully, false if operation failed or if gradient function is already registered to that `op_type`.
TF_CAPI_EXPORT extern bool TFJ_RegisterCustomGradient(const char* op_type, TFJ_GradFuncAdapter custom_gradient_adapter);

#ifdef __cplusplus
} /* end extern "C" */

#include "tfj_gradients_impl.cc" // include CC file in its header to compile it with JavaCPP
#endif

#endif // TENSORFLOW_JAVA_GRADIENTS_H_
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ limitations under the License.

#include "tensorflow/c/c_api.h"

#ifdef __cplusplus
extern "C" {
#endif

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

#ifdef __cplusplus
} /* end extern "C" */

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

#endif // TENSORFLOW_JAVA_GRAPH_H_
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#ifndef _WIN32

#include "tensorflow/c/c_api_internal.h"

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

} /* end extern "C" */

#else // #indef _WIN32

/* This extension is not available on Windows */
extern "C" {

TFJ_GraphId TFJ_GetGraphId(const TF_Graph* g) {
return NULL;
}

void TFJ_UnmapOperationName(TF_Graph* g, TF_Operation* operation) {}

} /* end extern "C" */

#endif // #indef _WIN32
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ limitations under the License.

#include "tensorflow/c/c_api.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct TFJ_Scope TFJ_Scope;

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

#ifdef __cplusplus
} /* end extern "C" */

#include "tfj_scope_impl.cc" // include CC file in its header to compile it with JavaCPP
#endif

#endif // TENSORFLOW_JAVA_SCOPE_H_

0 comments on commit 224b911

Please sign in to comment.