numpy.lib.array_utils.byte_bounds#

lib.array_utils.byte_bounds(a)[原始碼]#

傳回陣列端點的指標。

參數:
andarray

輸入陣列。它必須符合陣列介面的 Python 端。

傳回:
(low, high)2 個整數的元組

第一個整數是陣列的第一個位元組,第二個整數剛好超過陣列的最後一個位元組。如果 a 不是連續的,它將不會使用 (low, high) 值之間的所有位元組。

範例

>>> import numpy as np
>>> I = np.eye(2, dtype='f'); I.dtype
dtype('float32')
>>> low, high = np.lib.array_utils.byte_bounds(I)
>>> high - low == I.size*I.itemsize
True
>>> I = np.eye(2); I.dtype
dtype('float64')
>>> low, high = np.lib.array_utils.byte_bounds(I)
>>> high - low == I.size*I.itemsize
True