W3cubDocs

/NumPy 2.4

numpy.setbufsize

numpy.setbufsize(size)[source]

Set the size of the buffer used in ufuncs.

Changed in version 2.0: The scope of setting the buffer is tied to the numpy.errstate context. Exiting a with errstate(): will also restore the bufsize.

Parameters:
sizeint

Size of buffer.

Returns:
bufsizeint

Previous size of ufunc buffer in bytes.

Notes

Concurrency note: see Floating point error handling

Examples

When exiting a numpy.errstate context manager the bufsize is restored:

>>> import numpy as np
>>> with np.errstate():
...     np.setbufsize(4096)
...     print(np.getbufsize())
...
8192
4096
>>> np.getbufsize()
8192

© 2005–2024 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/2.4/reference/generated/numpy.setbufsize.html