本文整理匯總了Python中numpy.lib.utils.byte_bounds方法的典型用法代碼示例。如果您正苦於以下問題:Python utils.byte_bounds方法的具體用法?Python utils.byte_bounds怎麽用?Python utils.byte_bounds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類numpy.lib.utils
的用法示例。
在下文中一共展示了utils.byte_bounds方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_byte_bounds
# 需要導入模塊: from numpy.lib import utils [as 別名]
# 或者: from numpy.lib.utils import byte_bounds [as 別名]
def test_byte_bounds(self):
# pointer difference matches size * itemsize
# due to contiguity
a = arange(12).reshape(3, 4)
low, high = utils.byte_bounds(a)
assert_equal(high - low, a.size * a.itemsize)
示例2: test_unusual_order_positive_stride
# 需要導入模塊: from numpy.lib import utils [as 別名]
# 或者: from numpy.lib.utils import byte_bounds [as 別名]
def test_unusual_order_positive_stride(self):
a = arange(12).reshape(3, 4)
b = a.T
low, high = utils.byte_bounds(b)
assert_equal(high - low, b.size * b.itemsize)
示例3: test_unusual_order_negative_stride
# 需要導入模塊: from numpy.lib import utils [as 別名]
# 或者: from numpy.lib.utils import byte_bounds [as 別名]
def test_unusual_order_negative_stride(self):
a = arange(12).reshape(3, 4)
b = a.T[::-1]
low, high = utils.byte_bounds(b)
assert_equal(high - low, b.size * b.itemsize)
示例4: test_strided
# 需要導入模塊: from numpy.lib import utils [as 別名]
# 或者: from numpy.lib.utils import byte_bounds [as 別名]
def test_strided(self):
a = arange(12)
b = a[::2]
low, high = utils.byte_bounds(b)
# the largest pointer address is lost (even numbers only in the
# stride), and compensate addresses for striding by 2
assert_equal(high - low, b.size * 2 * b.itemsize - b.itemsize)
示例5: test_byte_bounds
# 需要導入模塊: from numpy.lib import utils [as 別名]
# 或者: from numpy.lib.utils import byte_bounds [as 別名]
def test_byte_bounds():
a = arange(12).reshape(3, 4)
low, high = utils.byte_bounds(a)
assert_equal(high - low, a.size * a.itemsize)