NumPy函数中'extobj'参数的正确使用方法及适用场景咨询
嘿,我最近在翻阅NumPy文档的时候注意到,所有NumPy的数学函数(比如add、multiply、log这类)都带有一个可选的extobj参数。关于这个参数,在ufunc关键字参数的说明里是这么描述的:
A list of length 3 specifying the ufunc buffer-size, the error mode integer, and the error call-back function. Normally, these values are looked up in a thread-specific dictionary. Passing them here circumvents that look up and uses the low-level specification provided for the error mode. This may be useful, for example, as an optimization for calculations requiring many ufunc calls on small arrays in a loop.
我自己琢磨着,这个参数应该是允许我们预分配一块缓冲区来承载计算过程,这样就不用每次内部运算都重新分配内存了。但我在网上搜了半天,甚至连官方文档里都找不到具体使用这个参数的实例或者更详细的指导。
所以想请教各位大佬:extobj的正确使用方式是什么?哪些场景下使用它会带来实际的好处呢?
备注:内容来源于stack exchange,提问作者bauerdavid

