ext: Update Pybind to Version 2.10.3
Updating Pybind11 is necessary for gem5 to compile correctly with Python 3.11. As of March 9th 2023, 2.10.3 is the latest version of Pybind11. Change-Id: I32c68c507770040d3fac2de442d88a8f46b48896 Issue-on: https://gem5.atlassian.net/browse/GEM5-1295 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/68818 Maintainer: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
committed by
Bobby Bruce
parent
b305019ac4
commit
07fca546e6
@@ -87,7 +87,7 @@ buffer objects (e.g. a NumPy matrix).
|
||||
/* Request a buffer descriptor from Python */
|
||||
py::buffer_info info = b.request();
|
||||
|
||||
/* Some sanity checks ... */
|
||||
/* Some basic validation checks ... */
|
||||
if (info.format != py::format_descriptor<Scalar>::format())
|
||||
throw std::runtime_error("Incompatible format: expected a double array!");
|
||||
|
||||
@@ -395,11 +395,9 @@ uses of ``py::array``:
|
||||
Ellipsis
|
||||
========
|
||||
|
||||
Python 3 provides a convenient ``...`` ellipsis notation that is often used to
|
||||
Python provides a convenient ``...`` ellipsis notation that is often used to
|
||||
slice multidimensional arrays. For instance, the following snippet extracts the
|
||||
middle dimensions of a tensor with the first and last index set to zero.
|
||||
In Python 2, the syntactic sugar ``...`` is not available, but the singleton
|
||||
``Ellipsis`` (of type ``ellipsis``) can still be used directly.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
@@ -414,8 +412,6 @@ operation on the C++ side:
|
||||
py::array a = /* A NumPy array */;
|
||||
py::array b = a[py::make_tuple(0, py::ellipsis(), 0)];
|
||||
|
||||
.. versionchanged:: 2.6
|
||||
``py::ellipsis()`` is now also available in Python 2.
|
||||
|
||||
Memory view
|
||||
===========
|
||||
@@ -437,7 +433,7 @@ following:
|
||||
{ 2, 4 }, // shape (rows, cols)
|
||||
{ sizeof(uint8_t) * 4, sizeof(uint8_t) } // strides in bytes
|
||||
);
|
||||
})
|
||||
});
|
||||
|
||||
This approach is meant for providing a ``memoryview`` for a C/C++ buffer not
|
||||
managed by Python. The user is responsible for managing the lifetime of the
|
||||
@@ -453,11 +449,7 @@ We can also use ``memoryview::from_memory`` for a simple 1D contiguous buffer:
|
||||
buffer, // buffer pointer
|
||||
sizeof(uint8_t) * 8 // buffer size
|
||||
);
|
||||
})
|
||||
|
||||
.. note::
|
||||
|
||||
``memoryview::from_memory`` is not available in Python 2.
|
||||
});
|
||||
|
||||
.. versionchanged:: 2.6
|
||||
``memoryview::from_memory`` added.
|
||||
|
||||
Reference in New Issue
Block a user