本文整理匯總了Python中numpy.core.iinfo方法的典型用法代碼示例。如果您正苦於以下問題:Python core.iinfo方法的具體用法?Python core.iinfo怎麽用?Python core.iinfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類numpy.core
的用法示例。
在下文中一共展示了core.iinfo方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_basic
# 需要導入模塊: from numpy import core [as 別名]
# 或者: from numpy.core import iinfo [as 別名]
def test_basic(self):
dts = list(zip(['i1', 'i2', 'i4', 'i8',
'u1', 'u2', 'u4', 'u8'],
[np.int8, np.int16, np.int32, np.int64,
np.uint8, np.uint16, np.uint32, np.uint64]))
for dt1, dt2 in dts:
for attr in ('bits', 'min', 'max'):
assert_equal(getattr(iinfo(dt1), attr),
getattr(iinfo(dt2), attr), attr)
assert_raises(ValueError, iinfo, 'f4')
示例2: test_unsigned_max
# 需要導入模塊: from numpy import core [as 別名]
# 或者: from numpy.core import iinfo [as 別名]
def test_unsigned_max(self):
types = np.sctypes['uint']
for T in types:
assert_equal(iinfo(T).max, T(-1))
示例3: test_iinfo_repr
# 需要導入模塊: from numpy import core [as 別名]
# 或者: from numpy.core import iinfo [as 別名]
def test_iinfo_repr(self):
expected = "iinfo(min=-32768, max=32767, dtype=int16)"
assert_equal(repr(np.iinfo(np.int16)), expected)
示例4: test_instances
# 需要導入模塊: from numpy import core [as 別名]
# 或者: from numpy.core import iinfo [as 別名]
def test_instances():
iinfo(10)
finfo(3.0)
示例5: test_basic
# 需要導入模塊: from numpy import core [as 別名]
# 或者: from numpy.core import iinfo [as 別名]
def test_basic(self):
dts = list(zip(['i1', 'i2', 'i4', 'i8',
'u1', 'u2', 'u4', 'u8'],
[np.int8, np.int16, np.int32, np.int64,
np.uint8, np.uint16, np.uint32, np.uint64]))
for dt1, dt2 in dts:
assert_equal(iinfo(dt1).min, iinfo(dt2).min)
assert_equal(iinfo(dt1).max, iinfo(dt2).max)
self.assertRaises(ValueError, iinfo, 'f4')