Browse Source

update pybind11 to 2.12, support numpy 2 (#5525)

tags/20240820
nihui GitHub 2 years ago
parent
commit
f2a34ee7ae
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 2 deletions
  1. +9
    -0
      python/CMakeLists.txt
  2. +1
    -1
      python/pybind11
  3. +1
    -1
      python/tests/test_mat.py

+ 9
- 0
python/CMakeLists.txt View File

@@ -30,6 +30,15 @@ if("${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" STREQUAL "")
endif(MSVC OR CMAKE_GENERATOR STREQUAL "Xcode")
endif("${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" STREQUAL "")

# enable global link time optimization
cmake_policy(SET CMP0069 NEW)
set(CMAKE_POLICY_DEFAULT_CMP0069 NEW)
include(CheckIPOSupported)
check_ipo_supported(RESULT ipo_supported OUTPUT ipo_supported_output)
if(ipo_supported)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()

include_directories(${pybind11_INCLUDE_DIR} ${PYTHON_INCLUDE_DIRS})
pybind11_add_module(pyncnn src/main.cpp)
set_target_properties(pyncnn PROPERTIES OUTPUT_NAME "ncnn")


+ 1
- 1
python/pybind11

@@ -1 +1 @@
Subproject commit 80dc998efced8ceb2be59756668a7e90e8bef917
Subproject commit 3e9dfa2866941655c56877882565e7577de6fc7b

+ 1
- 1
python/tests/test_mat.py View File

@@ -298,7 +298,7 @@ def test_fill():
mat = ncnn.Mat(1)
mat.fill(1.0)
array = np.array(mat)
assert np.abs(array[0] - 1.0) < sys.float_info.min
assert np.abs(array[0] - 1.0) < np.finfo(np.float32).eps


def test_clone():


Loading…
Cancel
Save