Skip to content

TensorFlow: remove the unnecessary code in CTensorFlow #29225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion stdlib/public/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ if(SWIFT_BUILD_STDLIB)
# dependency for `numpy.ndarray` bridging to `ShapedArray`/`Tensor`.
if(SWIFT_ENABLE_TENSORFLOW)
# TODO: Add TensorFlow support for iOS/Raspberry Pi.
add_subdirectory(CTensorFlow)
add_subdirectory(TensorFlow)
endif()
endif()
Expand Down
106 changes: 0 additions & 106 deletions stdlib/public/CTensorFlow/CMakeLists.txt

This file was deleted.

170 changes: 0 additions & 170 deletions stdlib/public/CTensorFlow/ctensorflow_init.cpp

This file was deleted.

48 changes: 0 additions & 48 deletions stdlib/public/CTensorFlow/ctensorflow_init.h

This file was deleted.

8 changes: 0 additions & 8 deletions stdlib/public/CTensorFlow/module.modulemap

This file was deleted.

27 changes: 24 additions & 3 deletions stdlib/public/TensorFlow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ if (TENSORFLOW_SWIFT_APIS)
endforeach()
endif()

get_filename_component(TensorFlow_LIBRARY_DIR ${TF_LIBRARY} DIRECTORY)
add_swift_target_library(swiftTensorFlow ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB
"${SOURCES}"

INCORPORATE_OBJECT_LIBRARIES swiftCTensorFlow
PRIVATE_LINK_LIBRARIES "${TF_LIBRARIES}"
SWIFT_MODULE_DEPENDS SwiftOnoneSupport
SWIFT_MODULE_DEPENDS_IOS Darwin
Expand All @@ -57,10 +57,31 @@ add_swift_target_library(swiftTensorFlow ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_
SWIFT_MODULE_DEPENDS_HAIKU Glibc
SWIFT_MODULE_DEPENDS_WINDOWS MSVCRT
SWIFT_MODULE_DEPENDS Python
SWIFT_COMPILE_FLAGS "${swift_stdlib_compile_flags}"
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}"
SWIFT_COMPILE_FLAGS
${swift_stdlib_compile_flags}
-Xcc -I${CMAKE_CURRENT_SOURCE_DIR}
-Xcc -I${TF_INCLUDE_DIR}
LINK_FLAGS
${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}
-L${TensorFlow_LIBRARY_DIR}
INSTALL_IN_COMPONENT stdlib
EXTRA_RPATHS "${SWIFT_TENSORFLOW_TARGET_LIB_DIR}"
# NOTE: This is a workaround for https://github.com/apple/swift/pull/24382,
# which changed the default install_name_dir to `/usr/bin/swift`.
DARWIN_INSTALL_NAME_DIR "@rpath")


swift_install_in_component(DIRECTORY ${TF_INCLUDE_DIR}/tensorflow/c/
DESTINATION lib/swift/tensorflow/tensorflow/c
COMPONENT stdlib
FILES_MATCHING
PATTERN c_api.h
PATTERN c_api_experimental.h
PATTERN tf_attrtype.h
PATTERN tf_datatype.h
PATTERN tf_status.h
PATTERN tf_tensor.h
PATTERN eager/c_api.h)
swift_install_in_component(FILES module.modulemap CTensorFlow.h
DESTINATION lib/swift/tensorflow
COMPONENT stdlib)
8 changes: 8 additions & 0 deletions stdlib/public/TensorFlow/CTensorFlow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#ifndef CTensorFlow_CTensorFlow_h
#define CTensorFlow_CTensorFlow_h

#include <tensorflow/c/c_api.h>
#include <tensorflow/c/c_api_experimental.h>
#include <tensorflow/c/eager/c_api.h>

#endif
Loading