diff --git a/src/TensorflowCpy/CMakeLists.txt b/src/TensorflowCpy/CMakeLists.txt index fdfaf32..7797b87 100644 --- a/src/TensorflowCpy/CMakeLists.txt +++ b/src/TensorflowCpy/CMakeLists.txt @@ -22,6 +22,7 @@ else() find_package(TensorFlow REQUIRED) else() add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/proto") + add_compile_definitions(ENABLE_TENSORFLOW_CPY=1) endif() endif() @@ -50,10 +51,6 @@ if(ENABLE_TORCH) else() if(USE_LIBTENSORFLOW_CC) target_include_directories(${PROJECT_NAME} PRIVATE ${TensorFlow_INCLUDE_DIRS}) - else() - target_include_directories( - ${PROJECT_NAME} PRIVATE $ - ) endif() endif() diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow.h new file mode 100644 index 0000000..ccff172 --- /dev/null +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow.h @@ -0,0 +1,41 @@ +#pragma once + +#include "./tensorflow/stream_executor/device_memory.h" +#include "./tensorflow/stream_executor/stream_executor_pimpl.h" +#include "./tensorflow/stream_executor/platform.h" + +#include "./tensorflow/cc/saved_model/loader.h" +#include "./tensorflow/cc/saved_model/tag_constants.h" + +#include "./tensorflow/core/util/stream_executor_util.h" + +#include "./tensorflow/core/platform/logging.h" +#include "./tensorflow/core/platform/statusor.h" +#include "./tensorflow/core/platform/refcount.h" +#include "./tensorflow/core/platform/types.h" +#include "./tensorflow/core/platform/macros.h" +#include "./tensorflow/core/platform/status.h" +#include "./tensorflow/core/platform/env.h" + +#include "./tensorflow/core/public/session_options.h" +#include "./tensorflow/core/public/session.h" + +#include "./tensorflow/core/common_runtime/device_mgr.h" +#include "./tensorflow/core/common_runtime/gpu/gpu_init.h" +#include "./tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.h" +#include "./tensorflow/core/common_runtime/device/device_id_utils.h" +#include "./tensorflow/core/common_runtime/device/device_mem_allocator.h" +#include "./tensorflow/core/common_runtime/device/device_id.h" + +#include "./tensorflow/core/framework/allocator.h" +#include "./tensorflow/core/framework/types.h" +#include "./tensorflow/core/framework/tensor_shape.h" +#include "./tensorflow/core/framework/tensor.h" +#include "./tensorflow/core/framework/device.h" +#include "./tensorflow/core/framework/op.h" + +namespace tensorflow_cpy { +namespace tensorflow { + using namespace ::tensorflow; +} // namespace tensorflow +} // namespace tensorflow_cpy diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/cc/saved_model/loader.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/cc/saved_model/loader.h index a191209..52aced8 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/cc/saved_model/loader.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/cc/saved_model/loader.h @@ -1,16 +1,19 @@ /// SavedModel loading functions and SavedModelBundle struct. -#ifndef TENSORFLOW_CC_SAVED_MODEL_LOADER_H_ -#define TENSORFLOW_CC_SAVED_MODEL_LOADER_H_ +#ifndef TENSORFLOW_CPY_CC_SAVED_MODEL_LOADER_H_ +#define TENSORFLOW_CPY_CC_SAVED_MODEL_LOADER_H_ #include #include -#include "tensorflow/core/platform/status.h" -#include "tensorflow/core/protobuf/meta_graph.pb.h" -#include "tensorflow/core/public/session.h" +#include +#include "../../core/platform/status.h" +#include "../../core/public/session.h" +// clang-format off +namespace tensorflow_cpy { namespace tensorflow { + using namespace ::tensorflow; /// SavedModel representation once the SavedModel is loaded from storage. @@ -73,5 +76,8 @@ Status LoadSavedModel(const SessionOptions& session_options, bool MaybeSavedModelDirectory(const std::string& export_dir); } // namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_CC_SAVED_MODEL_LOADER_H_ + +#endif // TENSORFLOW_CPY_CC_SAVED_MODEL_LOADER_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/cc/saved_model/tag_constants.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/cc/saved_model/tag_constants.h index c5f3b18..5b9a699 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/cc/saved_model/tag_constants.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/cc/saved_model/tag_constants.h @@ -1,6 +1,8 @@ -#ifndef TENSORFLOW_CC_SAVED_MODEL_TAG_CONSTANTS_H_ -#define TENSORFLOW_CC_SAVED_MODEL_TAG_CONSTANTS_H_ +#ifndef TENSORFLOW_CPY_CC_SAVED_MODEL_TAG_CONSTANTS_H_ +#define TENSORFLOW_CPY_CC_SAVED_MODEL_TAG_CONSTANTS_H_ +// clang-format off +namespace tensorflow_cpy { namespace tensorflow { /// Tag for the `gpu` graph. @@ -16,5 +18,8 @@ constexpr char kSavedModelTagServe[] = "serve"; constexpr char kSavedModelTagTrain[] = "train"; } // namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_CC_SAVED_MODEL_TAG_CONSTANTS_H_ + +#endif // TENSORFLOW_CPY_CC_SAVED_MODEL_TAG_CONSTANTS_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/device/device_id.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/device/device_id.h index ce78cae..b1484b6 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/device/device_id.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/device/device_id.h @@ -1,8 +1,10 @@ -#ifndef TENSORFLOW_CORE_COMMON_RUNTIME_DEVICE_DEVICE_ID_H_ -#define TENSORFLOW_CORE_COMMON_RUNTIME_DEVICE_DEVICE_ID_H_ +#ifndef TENSORFLOW_CPY_CORE_COMMON_RUNTIME_DEVICE_DEVICE_ID_H_ +#define TENSORFLOW_CPY_CORE_COMMON_RUNTIME_DEVICE_DEVICE_ID_H_ #include +// clang-format off +namespace tensorflow_cpy { namespace tensorflow { // There are three types of device ids: @@ -80,5 +82,8 @@ struct PlatformDeviceId{ }; } // namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_CORE_COMMON_RUNTIME_DEVICE_DEVICE_ID_H_ + +#endif // TENSORFLOW_CPY_CORE_COMMON_RUNTIME_DEVICE_DEVICE_ID_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/device/device_id_utils.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/device/device_id_utils.h index 3126b2f..052cd57 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/device/device_id_utils.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/device/device_id_utils.h @@ -1,12 +1,15 @@ -#ifndef TENSORFLOW_CORE_COMMON_RUNTIME_DEVICE_DEVICE_ID_UTILS_H_ -#define TENSORFLOW_CORE_COMMON_RUNTIME_DEVICE_DEVICE_ID_UTILS_H_ +#ifndef TENSORFLOW_CPY_CORE_COMMON_RUNTIME_DEVICE_DEVICE_ID_UTILS_H_ +#define TENSORFLOW_CPY_CORE_COMMON_RUNTIME_DEVICE_DEVICE_ID_UTILS_H_ #include -#include "tensorflow/core/common_runtime/device/device_id.h" -#include "tensorflow/stream_executor/platform.h" +#include "../../../core/common_runtime/device/device_id.h" +#include "../../../stream_executor/platform.h" +// clang-format off +namespace tensorflow_cpy { namespace tensorflow { + using namespace ::tensorflow; namespace se = stream_executor; // Utility methods for translation between TensorFlow device ids and platform @@ -27,5 +30,8 @@ class DeviceIdUtil { }; } // namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_CORE_COMMON_RUNTIME_DEVICE_DEVICE_ID_UTILS_H_ + +#endif // TENSORFLOW_CPY_CORE_COMMON_RUNTIME_DEVICE_DEVICE_ID_UTILS_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/device/device_mem_allocator.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/device/device_mem_allocator.h index 5543507..31f94ce 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/device/device_mem_allocator.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/device/device_mem_allocator.h @@ -1,12 +1,15 @@ -#ifndef TENSORFLOW_CORE_COMMON_RUNTIME_DEVICE_DEVICE_MEM_ALLOCATOR_H_ -#define TENSORFLOW_CORE_COMMON_RUNTIME_DEVICE_DEVICE_MEM_ALLOCATOR_H_ +#ifndef TENSORFLOW_CPY_CORE_COMMON_RUNTIME_DEVICE_DEVICE_MEM_ALLOCATOR_H_ +#define TENSORFLOW_CPY_CORE_COMMON_RUNTIME_DEVICE_DEVICE_MEM_ALLOCATOR_H_ -#include "tensorflow/core/common_runtime/device/device_id.h" -#include "tensorflow/core/framework/allocator.h" -#include "tensorflow/stream_executor/stream_executor_pimpl.h" +#include "../../../core/common_runtime/device/device_id.h" +#include "../../../core/framework/allocator.h" +#include "../../../stream_executor/stream_executor_pimpl.h" +// clang-format off +namespace tensorflow_cpy { namespace tensorflow { + using namespace ::tensorflow; namespace se = stream_executor; // Suballocator for StreamExecutor-based device memory. @@ -70,5 +73,8 @@ class DeviceMemAllocator : public SubAllocator { }; } // namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_CORE_COMMON_RUNTIME_DEVICE_DEVICE_MEM_ALLOCATOR_H_ + +#endif // TENSORFLOW_CPY_CORE_COMMON_RUNTIME_DEVICE_DEVICE_MEM_ALLOCATOR_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/device_mgr.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/device_mgr.h index cc95c2c..7d75ebd 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/device_mgr.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/device_mgr.h @@ -1,17 +1,19 @@ -#ifndef TENSORFLOW_CORE_COMMON_RUNTIME_DEVICE_MGR_H_ -#define TENSORFLOW_CORE_COMMON_RUNTIME_DEVICE_MGR_H_ +#ifndef TENSORFLOW_CPY_CORE_COMMON_RUNTIME_DEVICE_MGR_H_ +#define TENSORFLOW_CPY_CORE_COMMON_RUNTIME_DEVICE_MGR_H_ #include #include -#include "tensorflow/core/framework/device.h" -#include "tensorflow/core/framework/device_attributes.pb.h" -#include "tensorflow/core/platform/macros.h" +#include +#include "../../core/framework/device.h" +#include "../../core/platform/macros.h" +// clang-format off +namespace tensorflow_cpy { namespace tensorflow { -class DeviceAttributes; + using namespace ::tensorflow; // Represents a set of devices. class DeviceMgr { @@ -54,5 +56,8 @@ class DeviceMgr { static const size_t kStaleDeviceBufferSize = 8192; } // namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_CORE_COMMON_RUNTIME_DEVICE_MGR_H_ + +#endif // TENSORFLOW_CPY_CORE_COMMON_RUNTIME_DEVICE_MGR_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.h index ee4fa91..35f7456 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/gpu/gpu_bfc_allocator.h @@ -1,13 +1,16 @@ -#ifndef TENSORFLOW_CORE_COMMON_RUNTIME_GPU_GPU_BFC_ALLOCATOR_H_ -#define TENSORFLOW_CORE_COMMON_RUNTIME_GPU_GPU_BFC_ALLOCATOR_H_ +#ifndef TENSORFLOW_CPY_CORE_COMMON_RUNTIME_GPU_GPU_BFC_ALLOCATOR_H_ +#define TENSORFLOW_CPY_CORE_COMMON_RUNTIME_GPU_GPU_BFC_ALLOCATOR_H_ #include #include -#include "tensorflow/core/framework/allocator.h" +#include "../../../core/framework/allocator.h" +// clang-format off +namespace tensorflow_cpy { namespace tensorflow { + using namespace ::tensorflow; // A GPU memory allocator that implements a 'best-fit with coalescing' // algorithm. @@ -36,5 +39,8 @@ class GPUBFCAllocator : public Allocator { }; } // namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_CORE_COMMON_RUNTIME_GPU_GPU_BFC_ALLOCATOR_H_ + +#endif // TENSORFLOW_CPY_CORE_COMMON_RUNTIME_GPU_GPU_BFC_ALLOCATOR_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/gpu/gpu_init.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/gpu/gpu_init.h index f67ae81..591a523 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/gpu/gpu_init.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/common_runtime/gpu/gpu_init.h @@ -1,16 +1,23 @@ -#ifndef TENSORFLOW_CORE_COMMON_RUNTIME_GPU_GPU_INIT_H_ -#define TENSORFLOW_CORE_COMMON_RUNTIME_GPU_GPU_INIT_H_ +#ifndef TENSORFLOW_CPY_CORE_COMMON_RUNTIME_GPU_GPU_INIT_H_ +#define TENSORFLOW_CPY_CORE_COMMON_RUNTIME_GPU_GPU_INIT_H_ #include -#include "tensorflow/core/platform/status.h" +#include "../../../core/platform/status.h" +// clang-format off +namespace tensorflow_cpy { namespace stream_executor { class Platform; } // namespace stream_executor +} // namespace tensorflow_cpy +// clang-format on +// clang-format off +namespace tensorflow_cpy { namespace tensorflow { + using namespace ::tensorflow; // Initializes the GPU platform and returns OK if the GPU // platform could be initialized. @@ -28,5 +35,8 @@ stream_executor::Platform* GPUMachineManager(); std::string GpuPlatformName(); } // namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_CORE_COMMON_RUNTIME_GPU_GPU_INIT_H_ + +#endif // TENSORFLOW_CPY_CORE_COMMON_RUNTIME_GPU_GPU_INIT_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/allocator.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/allocator.h index b8ba66d..3ce6e36 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/allocator.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/allocator.h @@ -1,15 +1,18 @@ -#ifndef TENSORFLOW_CORE_FRAMEWORK_ALLOCATOR_H_ -#define TENSORFLOW_CORE_FRAMEWORK_ALLOCATOR_H_ +#ifndef TENSORFLOW_CPY_CORE_FRAMEWORK_ALLOCATOR_H_ +#define TENSORFLOW_CPY_CORE_FRAMEWORK_ALLOCATOR_H_ #include #include #include -#include "tensorflow/core/platform/logging.h" -#include "tensorflow/core/platform/macros.h" +#include "../../core/platform/logging.h" +#include "../../core/platform/macros.h" +// clang-format off +namespace tensorflow_cpy { namespace tensorflow { + using namespace ::tensorflow; // Runtime statistics collected by an allocator. Exactly the same as // stream_executor::AllocatorStats, but independently defined to preserve the @@ -221,5 +224,8 @@ class SubAllocator { }; } // namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_CORE_FRAMEWORK_ALLOCATOR_H_ + +#endif // TENSORFLOW_CPY_CORE_FRAMEWORK_ALLOCATOR_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/device.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/device.h index e39df45..f23aaae 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/device.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/device.h @@ -12,17 +12,20 @@ // * Task numbers are within the specified replica, so there are as // many "task zeros" as replicas. -#ifndef TENSORFLOW_CORE_FRAMEWORK_DEVICE_H_ -#define TENSORFLOW_CORE_FRAMEWORK_DEVICE_H_ +#ifndef TENSORFLOW_CPY_CORE_FRAMEWORK_DEVICE_H_ +#define TENSORFLOW_CPY_CORE_FRAMEWORK_DEVICE_H_ #include -#include "tensorflow/core/framework/allocator.h" -#include "tensorflow/core/framework/device_attributes.pb.h" -#include "tensorflow/core/platform/env.h" -#include "tensorflow/core/platform/status.h" +#include +#include "../../core/framework/allocator.h" +#include "../../core/platform/env.h" +#include "../../core/platform/status.h" +// clang-format off +namespace tensorflow_cpy { namespace tensorflow { + using namespace ::tensorflow; class DeviceBase { public: explicit DeviceBase(Env* env) : env_(env) {} @@ -85,5 +88,8 @@ class Device : public DeviceBase { }; } // namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_CORE_FRAMEWORK_DEVICE_H_ + +#endif // TENSORFLOW_CPY_CORE_FRAMEWORK_DEVICE_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/op.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/op.h index f759652..ee82eea 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/op.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/op.h @@ -1,9 +1,12 @@ -#ifndef TENSORFLOW_CORE_FRAMEWORK_OP_H_ -#define TENSORFLOW_CORE_FRAMEWORK_OP_H_ +#ifndef TENSORFLOW_CPY_CORE_FRAMEWORK_OP_H_ +#define TENSORFLOW_CPY_CORE_FRAMEWORK_OP_H_ -#include "tensorflow/core/platform/status.h" +#include "../../core/platform/status.h" +// clang-format off +namespace tensorflow_cpy { namespace tensorflow { + using namespace ::tensorflow; // The standard implementation of OpRegistryInterface, along with a // global singleton used for registering ops via the REGISTER @@ -48,5 +51,8 @@ class OpRegistry { }; } // namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_CORE_FRAMEWORK_OP_H_ + +#endif // TENSORFLOW_CPY_CORE_FRAMEWORK_OP_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/tensor.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/tensor.h index 3d0c50b..3c13261 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/tensor.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/tensor.h @@ -1,21 +1,25 @@ -#ifndef TENSORFLOW_CORE_FRAMEWORK_TENSOR_H_ -#define TENSORFLOW_CORE_FRAMEWORK_TENSOR_H_ +#ifndef TENSORFLOW_CPY_CORE_FRAMEWORK_TENSOR_H_ +#define TENSORFLOW_CPY_CORE_FRAMEWORK_TENSOR_H_ #include #include -#include "tensorflow/core/framework/tensor_shape.h" -#include "tensorflow/core/framework/types.pb.h" -#include "tensorflow/core/platform/refcount.h" -#include "tensorflow/core/platform/macros.h" -#include "tensorflow/core/framework/allocator.h" +#include +#include "../../core/framework/tensor_shape.h" +#include "../../core/platform/refcount.h" +#include "../../core/platform/macros.h" +#include "../../core/framework/allocator.h" namespace tensorflow { - // Forward declarations. In particular, we forward declare protos so that their // symbols can be removed from .so exports. class AllocationDescription; +} +// clang-format off +namespace tensorflow_cpy { +namespace tensorflow { + using namespace ::tensorflow; /// @ingroup core /// Interface to access the raw ref-counted data buffer. @@ -352,5 +356,8 @@ class Tensor { }; } // namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on + -#endif // TENSORFLOW_CORE_FRAMEWORK_TENSOR_H_ +#endif // TENSORFLOW_CPY_CORE_FRAMEWORK_TENSOR_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/tensor_shape.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/tensor_shape.h index 4ad1aa5..633fdab 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/tensor_shape.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/tensor_shape.h @@ -1,12 +1,15 @@ -#ifndef TENSORFLOW_CORE_FRAMEWORK_TENSOR_SHAPE_H_ -#define TENSORFLOW_CORE_FRAMEWORK_TENSOR_SHAPE_H_ +#ifndef TENSORFLOW_CPY_CORE_FRAMEWORK_TENSOR_SHAPE_H_ +#define TENSORFLOW_CPY_CORE_FRAMEWORK_TENSOR_SHAPE_H_ #include -#include "tensorflow/core/platform/status.h" -#include "tensorflow/core/platform/logging.h" +#include "../../core/platform/status.h" +#include "../../core/platform/logging.h" +// clang-format off +namespace tensorflow_cpy { namespace tensorflow { + using namespace ::tensorflow; // START_SKIP_DOXYGEN template @@ -218,5 +221,8 @@ class TensorShapeUtils { } // namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_CORE_FRAMEWORK_TENSOR_SHAPE_H_ + +#endif // TENSORFLOW_CPY_CORE_FRAMEWORK_TENSOR_SHAPE_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/types.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/types.h index 50123af..0cb24ab 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/types.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/framework/types.h @@ -1,14 +1,17 @@ -#ifndef TENSORFLOW_CORE_FRAMEWORK_TYPES_H_ -#define TENSORFLOW_CORE_FRAMEWORK_TYPES_H_ +#ifndef TENSORFLOW_CPY_CORE_FRAMEWORK_TYPES_H_ +#define TENSORFLOW_CPY_CORE_FRAMEWORK_TYPES_H_ #include -#include "tensorflow/core/framework/types.pb.h" -#include "tensorflow/core/platform/types.h" -#include "tensorflow/core/platform/macros.h" +#include +#include "../../core/platform/types.h" +#include "../../core/platform/macros.h" +// clang-format off +namespace tensorflow_cpy { namespace tensorflow { + using namespace ::tensorflow; class Variant; @@ -125,5 +128,8 @@ struct DataTypeToEnum { int DataTypeSize(DataType dt); } // namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_CORE_FRAMEWORK_TYPES_H_ + +#endif // TENSORFLOW_CPY_CORE_FRAMEWORK_TYPES_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/env.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/env.h index d7410f5..03722eb 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/env.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/env.h @@ -1,16 +1,19 @@ -#ifndef TENSORFLOW_CORE_PLATFORM_ENV_H_ -#define TENSORFLOW_CORE_PLATFORM_ENV_H_ +#ifndef TENSORFLOW_CPY_CORE_PLATFORM_ENV_H_ +#define TENSORFLOW_CPY_CORE_PLATFORM_ENV_H_ #include #include #include -#include "tensorflow/core/platform/status.h" +#include "../../core/platform/status.h" +// clang-format off +namespace tensorflow_cpy { namespace tensorflow { + using namespace ::tensorflow; /// \brief An interface used by the tensorflow implementation to /// access operating system functionality like the filesystem etc. @@ -118,5 +121,8 @@ int setenv(const char* name, const char* value, int overwrite); int unsetenv(const char* name); } // namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_CORE_PLATFORM_ENV_H_ + +#endif // TENSORFLOW_CPY_CORE_PLATFORM_ENV_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/logging.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/logging.h index 38325fb..8ec4847 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/logging.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/logging.h @@ -1,14 +1,17 @@ -#ifndef TENSORFLOW_CORE_PLATFORM_LOGGING_H_ -#define TENSORFLOW_CORE_PLATFORM_LOGGING_H_ +#ifndef TENSORFLOW_CPY_CORE_PLATFORM_LOGGING_H_ +#define TENSORFLOW_CPY_CORE_PLATFORM_LOGGING_H_ #include -#include "tensorflow/core/platform/macros.h" +#include "../../core/platform/macros.h" #undef ERROR +// clang-format off +namespace tensorflow_cpy { namespace tensorflow { + using namespace ::tensorflow; const int INFO = 0; // base_logging::INFO; const int WARNING = 1; // base_logging::WARNING; const int ERROR = 2; // base_logging::ERROR; @@ -52,13 +55,13 @@ class LogMessageNull : public std::basic_ostringstream { }; #define _TF_LOG_INFO \ - ::tensorflow::internal::LogMessage(__FILE__, __LINE__, ::tensorflow::INFO) + ::tensorflow_cpy::tensorflow::internal::LogMessage(__FILE__, __LINE__, ::tensorflow_cpy::tensorflow::INFO) #define _TF_LOG_WARNING \ - ::tensorflow::internal::LogMessage(__FILE__, __LINE__, ::tensorflow::WARNING) + ::tensorflow_cpy::tensorflow::internal::LogMessage(__FILE__, __LINE__, ::tensorflow_cpy::tensorflow::WARNING) #define _TF_LOG_ERROR \ - ::tensorflow::internal::LogMessage(__FILE__, __LINE__, ::tensorflow::ERROR) + ::tensorflow_cpy::tensorflow::internal::LogMessage(__FILE__, __LINE__, ::tensorflow_cpy::tensorflow::ERROR) #define _TF_LOG_FATAL \ - ::tensorflow::internal::LogMessageFatal(__FILE__, __LINE__) + ::tensorflow_cpy::tensorflow::internal::LogMessageFatal(__FILE__, __LINE__) #define _TF_LOG_QFATAL _TF_LOG_FATAL @@ -77,10 +80,10 @@ class LogMessageNull : public std::basic_ostringstream { // In optimized mode, use CheckOpString to hint to compiler that // the while condition is unlikely. //#define CHECK_OP_LOG(name, op, val1, val2) \ - //while (::tensorflow::internal::CheckOpString _result{ \ - //::tensorflow::internal::name##Impl( \ - //::tensorflow::internal::GetReferenceableValue(val1), \ - //::tensorflow::internal::GetReferenceableValue(val2), \ + //while (::tensorflow_cpy::tensorflow::internal::CheckOpString _result{ \ + //::tensorflow_cpy::tensorflow::internal::name##Impl( \ + //::tensorflow_cpy::tensorflow::internal::GetReferenceableValue(val1), \ + //::tensorflow_cpy::tensorflow::internal::GetReferenceableValue(val2), \ //#val1 " " #op " " #val2)}) \ //::tensorflow::internal::LogMessageFatal(__FILE__, __LINE__) << *(_result.str_) #define CHECK_OP_LOG(name, op, val1, val2) @@ -95,7 +98,7 @@ class LogMessageNull : public std::basic_ostringstream { #define CHECK_GE(val1, val2) CHECK_OP(Check_GE, >=, val1, val2) #define CHECK_GT(val1, val2) CHECK_OP(Check_GT, >, val1, val2) #define CHECK_NOTNULL(val) \ - ::tensorflow::internal::CheckNotNull(__FILE__, __LINE__, \ + ::tensorflow_cpy::tensorflow::internal::CheckNotNull(__FILE__, __LINE__, \ "'" #val "' Must be non NULL", (val)) #ifndef NDEBUG @@ -170,5 +173,8 @@ void LogString(const char* fname, int line, int severity, } // namespace internal } // namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_CORE_PLATFORM_LOGGING_H_ + +#endif // TENSORFLOW_CPY_CORE_PLATFORM_LOGGING_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/macros.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/macros.h index e15d60f..687d34a 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/macros.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/macros.h @@ -1,6 +1,6 @@ -#ifndef TENSORFLOW_CORE_PLATFORM_MACROS_H_ -#define TENSORFLOW_CORE_PLATFORM_MACROS_H_ +#ifndef TENSORFLOW_CPY_CORE_PLATFORM_MACROS_H_ +#define TENSORFLOW_CPY_CORE_PLATFORM_MACROS_H_ // Compiler attributes @@ -127,4 +127,4 @@ #define SE_PREDICT_TRUE TF_PREDICT_TRUE #define SE_PREDICT_FALSE TF_PREDICT_FALSE -#endif // TENSORFLOW_CORE_PLATFORM_MACROS_H_ +#endif // TENSORFLOW_CPY_CORE_PLATFORM_MACROS_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/refcount.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/refcount.h index 9857500..b241d97 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/refcount.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/refcount.h @@ -1,9 +1,11 @@ -#ifndef TENSORFLOW_CORE_PLATFORM_REFCOUNT_H_ -#define TENSORFLOW_CORE_PLATFORM_REFCOUNT_H_ +#ifndef TENSORFLOW_CPY_CORE_PLATFORM_REFCOUNT_H_ +#define TENSORFLOW_CPY_CORE_PLATFORM_REFCOUNT_H_ #include #include +// clang-format off +namespace tensorflow_cpy { namespace tensorflow { namespace core { @@ -52,5 +54,8 @@ using RefCountPtr = std::unique_ptr; } // namespace core } // namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_CORE_PLATFORM_REFCOUNT_H_ + +#endif // TENSORFLOW_CPY_CORE_PLATFORM_REFCOUNT_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/status.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/status.h index e5883b1..6b425e6 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/status.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/status.h @@ -1,14 +1,17 @@ -#ifndef TENSORFLOW_CORE_PLATFORM_STATUS_H_ -#define TENSORFLOW_CORE_PLATFORM_STATUS_H_ +#ifndef TENSORFLOW_CPY_CORE_PLATFORM_STATUS_H_ +#define TENSORFLOW_CPY_CORE_PLATFORM_STATUS_H_ #include #include -#include "tensorflow/core/platform/macros.h" -#include "tensorflow/core/protobuf/error_codes.pb.h" +#include +#include "../../core/platform/macros.h" +// clang-format off +namespace tensorflow_cpy { namespace tensorflow { + using namespace ::tensorflow; #if defined(__clang__) // Only clang supports warn_unused_result as a type annotation. @@ -37,7 +40,7 @@ class Status { /// Returns true iff the status indicates success. bool ok() const; - tensorflow::error::Code code() const; + errors::Code code() const; const std::string& error_message() const ; @@ -85,7 +88,7 @@ Status OkStatus(); std::ostream& operator<<(std::ostream& os, const Status& x); -std::string error_name(error::Code code); +std::string error_name(errors::Code code); /* inline std::string* TfCheckOpHelper(::tensorflow::Status v, @@ -112,5 +115,8 @@ inline std::string* TfCheckOpHelper(::tensorflow::Status v, */ } // namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_CORE_PLATFORM_STATUS_H_ + +#endif // TENSORFLOW_CPY_CORE_PLATFORM_STATUS_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/statusor.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/statusor.h index dfa517d..92029c5 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/statusor.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/statusor.h @@ -51,13 +51,16 @@ // stored value cannot invalidate the argument; in other words, the argument // cannot be an alias for the current value, or anything owned by the current // value. -#ifndef TENSORFLOW_CORE_PLATFORM_STATUSOR_H_ -#define TENSORFLOW_CORE_PLATFORM_STATUSOR_H_ +#ifndef TENSORFLOW_CPY_CORE_PLATFORM_STATUSOR_H_ +#define TENSORFLOW_CPY_CORE_PLATFORM_STATUSOR_H_ -#include "tensorflow/core/platform/macros.h" -#include "tensorflow/core/platform/status.h" +#include "../../core/platform/macros.h" +#include "../../core/platform/status.h" +// clang-format off +namespace tensorflow_cpy { namespace tensorflow { + using namespace ::tensorflow; #if defined(__clang__) // Only clang supports warn_unused_result as a type annotation. @@ -237,12 +240,8 @@ class StatusOr { lhs = std::move(statusor).ValueOrDie() } // namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on -namespace stream_executor { -namespace port { - using ::tensorflow::Status; - using ::tensorflow::StatusOr; -}; -}; -#endif // TENSORFLOW_CORE_PLATFORM_STATUSOR_H_ +#endif // TENSORFLOW_CPY_CORE_PLATFORM_STATUSOR_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/types.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/types.h index 8343029..bc0900a 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/types.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/platform/types.h @@ -1,9 +1,11 @@ -#ifndef TENSORFLOW_CORE_PLATFORM_TYPES_H_ -#define TENSORFLOW_CORE_PLATFORM_TYPES_H_ +#ifndef TENSORFLOW_CPY_CORE_PLATFORM_TYPES_H_ +#define TENSORFLOW_CPY_CORE_PLATFORM_TYPES_H_ #include +// clang-format off +namespace tensorflow_cpy { namespace tensorflow { typedef signed char int8; @@ -18,6 +20,7 @@ typedef std::uint64_t uint64; } // namespace tensorflow + namespace tensorflow { static const uint8 kuint8max = static_cast(0xFF); @@ -37,5 +40,8 @@ static const int64_t kint64max = static_cast(0x7FFFFFFFFFFFFFFFll); typedef uint64 Fprint; } // namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on + -#endif // TENSORFLOW_CORE_PLATFORM_TYPES_H_ +#endif // TENSORFLOW_CPY_CORE_PLATFORM_TYPES_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/public/session.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/public/session.h index a3239b5..167c401 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/public/session.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/public/session.h @@ -1,18 +1,23 @@ -#ifndef TENSORFLOW_CORE_PUBLIC_SESSION_H_ -#define TENSORFLOW_CORE_PUBLIC_SESSION_H_ +#ifndef TENSORFLOW_CPY_CORE_PUBLIC_SESSION_H_ +#define TENSORFLOW_CPY_CORE_PUBLIC_SESSION_H_ #include #include -#include "tensorflow/core/framework/device_attributes.pb.h" -#include "tensorflow/core/framework/graph.pb.h" -#include "tensorflow/core/framework/tensor.h" -#include "tensorflow/core/platform/status.h" -#include "tensorflow/core/protobuf/config.pb.h" -#include "tensorflow/core/public/session_options.h" +#include +#include +#include +#include "../../core/framework/tensor.h" +#include "../../core/platform/status.h" +#include "../../core/public/session_options.h" + +// clang-format off +namespace tensorflow_cpy { namespace tensorflow { + using namespace ::tensorflow; + class DeviceMgr; @@ -268,5 +273,7 @@ Status Reset(const SessionOptions& options, Session* NewSession(const SessionOptions& options); } // end namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_CORE_PUBLIC_SESSION_H_ +#endif // TENSORFLOW_CPY_CORE_PUBLIC_SESSION_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/public/session_options.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/public/session_options.h index 08309c3..c2969e4 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/public/session_options.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/public/session_options.h @@ -1,10 +1,13 @@ -#ifndef TENSORFLOW_PUBLIC_SESSION_OPTIONS_H_ -#define TENSORFLOW_PUBLIC_SESSION_OPTIONS_H_ +#ifndef TENSORFLOW_CPY_PUBLIC_SESSION_OPTIONS_H_ +#define TENSORFLOW_CPY_PUBLIC_SESSION_OPTIONS_H_ #include -#include "tensorflow/core/protobuf/config.pb.h" +#include +// clang-format off +namespace tensorflow_cpy { namespace tensorflow { + using namespace ::tensorflow; class Env; @@ -45,5 +48,7 @@ struct SessionOptions { }; } // end namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_PUBLIC_SESSION_OPTIONS_H_ +#endif // TENSORFLOW_CPY_PUBLIC_SESSION_OPTIONS_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/util/stream_executor_util.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/util/stream_executor_util.h index e8716a0..7b24203 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/util/stream_executor_util.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/core/util/stream_executor_util.h @@ -1,11 +1,14 @@ -#ifndef TENSORFLOW_CORE_UTIL_STREAM_EXECUTOR_UTIL_H_ -#define TENSORFLOW_CORE_UTIL_STREAM_EXECUTOR_UTIL_H_ +#ifndef TENSORFLOW_CPY_CORE_UTIL_STREAM_EXECUTOR_UTIL_H_ +#define TENSORFLOW_CPY_CORE_UTIL_STREAM_EXECUTOR_UTIL_H_ -#include "tensorflow/core/framework/tensor.h" -#include "tensorflow/stream_executor/device_memory.h" +#include "../../core/framework/tensor.h" +#include "../../stream_executor/device_memory.h" +// clang-format off +namespace tensorflow_cpy { namespace tensorflow { + using namespace ::tensorflow; namespace se = stream_executor; // StreamExecutorUtil contains functions useful for interfacing @@ -22,5 +25,8 @@ class StreamExecutorUtil { }; } // namespace tensorflow +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_CORE_UTIL_STREAM_EXECUTOR_UTIL_H_ + +#endif // TENSORFLOW_CPY_CORE_UTIL_STREAM_EXECUTOR_UTIL_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/stream_executor/device_memory.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/stream_executor/device_memory.h index ce3977d..78fc01e 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/stream_executor/device_memory.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/stream_executor/device_memory.h @@ -6,13 +6,15 @@ // be specialized for a given allocation type (like a device T*) using // DeviceMemory. -#ifndef TENSORFLOW_STREAM_EXECUTOR_DEVICE_MEMORY_H_ -#define TENSORFLOW_STREAM_EXECUTOR_DEVICE_MEMORY_H_ +#ifndef TENSORFLOW_CPY_STREAM_EXECUTOR_DEVICE_MEMORY_H_ +#define TENSORFLOW_CPY_STREAM_EXECUTOR_DEVICE_MEMORY_H_ #include #include +// clang-format off +namespace tensorflow_cpy { namespace stream_executor { class DeviceMemoryAllocator; @@ -143,5 +145,7 @@ class DeviceMemory final : public DeviceMemoryBase { }; } // namespace stream_executor +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_STREAM_EXECUTOR_DEVICE_MEMORY_H_ +#endif // TENSORFLOW_CPY_STREAM_EXECUTOR_DEVICE_MEMORY_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/stream_executor/platform.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/stream_executor/platform.h index 756ece2..42d677d 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/stream_executor/platform.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/stream_executor/platform.h @@ -1,21 +1,22 @@ // Defines types and declares functions for identifying and extracting // information about the types of platforms and supporting libraries for which // StreamExecutor implementations exist. -#ifndef TENSORFLOW_STREAM_EXECUTOR_PLATFORM_H_ -#define TENSORFLOW_STREAM_EXECUTOR_PLATFORM_H_ +#ifndef TENSORFLOW_CPY_STREAM_EXECUTOR_PLATFORM_H_ +#define TENSORFLOW_CPY_STREAM_EXECUTOR_PLATFORM_H_ #include +#include -//#include "tensorflow/stream_executor/device_options.h" -//#include "tensorflow/stream_executor/lib/status.h" -#include "tensorflow/core/platform/statusor.h" -//#include "tensorflow/stream_executor/platform/port.h" -//#include "tensorflow/stream_executor/plugin.h" -//#include "tensorflow/stream_executor/trace_listener.h" - +#include "../core/platform/statusor.h" +// clang-format off +namespace tensorflow_cpy { namespace stream_executor { -//#include "tensorflow/stream_executor/device_description.h" +namespace port { + using ::tensorflow_cpy::tensorflow::Status; + using ::tensorflow_cpy::tensorflow::StatusOr; +}; +//#include "../stream_executor/device_description.h" // Data that describes the execution target of the StreamExecutor, in terms of // important logical parameters. These include dimensionality limits and // physical parameters of interest, such as number of cores present on the @@ -356,5 +357,7 @@ class Platform { }; } // namespace stream_executor +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_STREAM_EXECUTOR_PLATFORM_H_ +#endif // TENSORFLOW_CPY_STREAM_EXECUTOR_PLATFORM_H_ diff --git a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/stream_executor/stream_executor_pimpl.h b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/stream_executor/stream_executor_pimpl.h index 89a6c4e..6f32b26 100644 --- a/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/stream_executor/stream_executor_pimpl.h +++ b/src/TensorflowCpy/include/tensorflow_cpy/tensorflow/stream_executor/stream_executor_pimpl.h @@ -1,13 +1,16 @@ -#ifndef TENSORFLOW_STREAM_EXECUTOR_STREAM_EXECUTOR_PIMPL_H_ -#define TENSORFLOW_STREAM_EXECUTOR_STREAM_EXECUTOR_PIMPL_H_ +#ifndef TENSORFLOW_CPY_STREAM_EXECUTOR_STREAM_EXECUTOR_PIMPL_H_ +#define TENSORFLOW_CPY_STREAM_EXECUTOR_STREAM_EXECUTOR_PIMPL_H_ -#include "tensorflow/stream_executor/device_memory.h" -#include "tensorflow/core/platform/statusor.h" -#include "tensorflow/stream_executor/platform.h" +#include "../core/platform/statusor.h" +#include "../stream_executor/device_memory.h" +#include "../stream_executor/platform.h" +// clang-format off +namespace tensorflow_cpy { namespace stream_executor { + using namespace ::tensorflow; class Stream; @@ -276,5 +279,7 @@ class StreamExecutor { }; } // namespace stream_executor +} // namespace tensorflow_cpy +// clang-format on -#endif // TENSORFLOW_STREAM_EXECUTOR_STREAM_EXECUTOR_PIMPL_H_ +#endif // TENSORFLOW_CPY_STREAM_EXECUTOR_STREAM_EXECUTOR_PIMPL_H_ diff --git a/src/TensorflowCpy/proto/CMakeLists.txt b/src/TensorflowCpy/proto/CMakeLists.txt index 3258bec..01c5660 100644 --- a/src/TensorflowCpy/proto/CMakeLists.txt +++ b/src/TensorflowCpy/proto/CMakeLists.txt @@ -15,5 +15,5 @@ protobuf_generate( IMPORT_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/tensorflow" ) -target_include_directories(proto-objects PUBLIC "$") +target_include_directories(proto-objects SYSTEM PUBLIC "$") target_link_libraries(proto-objects PUBLIC protobuf::libprotobuf) diff --git a/src/TensorflowCpy/source/framework.cpp b/src/TensorflowCpy/source/framework.cpp index ee90a5c..8093e96 100644 --- a/src/TensorflowCpy/source/framework.cpp +++ b/src/TensorflowCpy/source/framework.cpp @@ -30,6 +30,12 @@ void wait_for_debugger_attach() { #pragma GCC diagnostic ignored "-Wunused-variable" +#if ENABLE_TENSORFLOW_CPY +#include + +namespace tf = tensorflow_cpy::tensorflow; +namespace se = tensorflow_cpy::stream_executor; +#else #include #include #include @@ -47,10 +53,11 @@ void wait_for_debugger_attach() { #include #include -#pragma GCC diagnostic pop - namespace tf = tensorflow; namespace se = stream_executor; +#endif + +#pragma GCC diagnostic pop class TensorBufferView : public tf::TensorBuffer { std::size_t m_len;