Cnpy is having trouble when used in conjunction with PyTorch. I boiled down the problem to having included PyTorch in the CMakeLists.txt as follows
FIND_PACKAGE(Torch REQUIRED)
FIND_PACKAGE(ZLIB REQUIRED)
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
INCLUDE_DIRECTORIES("/home/USER/cnpy")
LINK_DIRECTORIES("/home/USER/cnpy/build")
add_executable(example1 example1.cpp)
target_link_libraries(example1 cnpy)
TARGET_LINK_LIBRARIES(example1 "${TORCH_LIBRARIES}")
TARGET_LINK_LIBRARIES(example1 ${ZLIB_LIBRARIES})
When I do not enforce PyTorch to be found, the example code in the repository runs fine with loading cnpy. Otherwise, I get the following error.

Cnpy is having trouble when used in conjunction with PyTorch. I boiled down the problem to having included PyTorch in the CMakeLists.txt as follows
When I do not enforce PyTorch to be found, the example code in the repository runs fine with loading cnpy. Otherwise, I get the following error.