Home | History | Annotate | Download | only in c
      1 /* Copyright 2018 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 distributed 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_C_C_API_EXPERIMENTAL_H_
     17 #define TENSORFLOW_C_C_API_EXPERIMENTAL_H_
     18 
     19 #include <stddef.h>
     20 #include <stdint.h>
     21 
     22 #include "tensorflow/c/c_api.h"
     23 
     24 // --------------------------------------------------------------------------
     25 // Experimental C API for TensorFlow.
     26 //
     27 // The API here is subject to changes in the future.
     28 
     29 // Macro to control visibility of exported symbols in the shared library (.so,
     30 // .dylib, .dll).
     31 // This duplicates the TF_EXPORT macro definition in
     32 // tensorflow/core/platform/macros.h in order to keep this .h file independent
     33 // of any other includes.$a
     34 #ifdef SWIG
     35 #define TF_CAPI_EXPORT
     36 #else
     37 #if defined(COMPILER_MSVC)
     38 #ifdef TF_COMPILE_LIBRARY
     39 #define TF_CAPI_EXPORT __declspec(dllexport)
     40 #else
     41 #define TF_CAPI_EXPORT __declspec(dllimport)
     42 #endif  // TF_COMPILE_LIBRARY
     43 #else
     44 #define TF_CAPI_EXPORT __attribute__((visibility("default")))
     45 #endif  // COMPILER_MSVC
     46 #endif  // SWIG
     47 
     48 #ifdef __cplusplus
     49 extern "C" {
     50 #endif
     51 
     52 // When `enable` is true, set
     53 // tensorflow.ConfigProto.OptimizerOptions.global_jit_level to ON_1, and also
     54 // set XLA flag values to prepare for XLA compilation. Otherwise set
     55 // global_jit_level to OFF.
     56 //
     57 // This API is syntax sugar over TF_SetConfig(), and is used by clients that
     58 // cannot read/write the tensorflow.ConfigProto proto.
     59 TF_CAPI_EXPORT extern void TF_EnableXLACompilation(TF_SessionOptions* options,
     60                                                    unsigned char enable);
     61 
     62 #ifdef __cplusplus
     63 } /* end extern "C" */
     64 #endif
     65 
     66 #endif  // TENSORFLOW_C_C_API_EXPERIMENTAL_H_
     67