日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程语言 > python >内容正文

python

python numpy np.finfo()函数 eps

發(fā)布時(shí)間:2025/3/19 python 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python numpy np.finfo()函数 eps 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

用法

finfo函數(shù)是根據(jù)括號(hào)中的類型來(lái)獲得信息,獲得符合這個(gè)類型的數(shù)型

例1:

import numpy as np a=np.array([[1],[2],[-1],[0]]) b=np.maximum(a,np.finfo(np.float32).eps) print(b)

結(jié)果:

[[1.0000000e+00][2.0000000e+00][1.1920929e-07][1.1920929e-07]]

例2:

ious = np.maximum(1.0 * inter_area / union_area, np.finfo(np.float32).eps)

eps是取非負(fù)的最小值。當(dāng)計(jì)算的IOU為0或?yàn)樨?fù)(但從代碼上來(lái)看不太可能為負(fù)),使用np.finfo(np.float32).eps來(lái)替換

doc

finfo(dtype)Machine limits for floating point types. 浮點(diǎn)類型的機(jī)器限制。Attributes 屬性 ---------- eps : floating point number of the appropriate typeThe smallest representable number such that ``1.0 + eps != 1.0``.適當(dāng)類型的浮點(diǎn)數(shù)最小的可表示數(shù)字,例如``1.0 + eps!= 1.0''。epsneg : floating point number of the appropriate typeThe smallest representable number such that ``1.0 - epsneg != 1.0``.適當(dāng)類型的浮點(diǎn)數(shù)最小的可表示數(shù)字,例如``1.0-epsneg!= 1.0''。iexp : intThe number of bits in the exponent portion of the floating pointrepresentation.浮點(diǎn)表示形式的指數(shù)部分中的位數(shù)。machar : MachArThe object which calculated these parameters and holds more detailedinformation.計(jì)算這些參數(shù)并保存更多詳細(xì)信息的對(duì)象。machep : intThe exponent that yields ``eps``.產(chǎn)生``eps''的指數(shù)。max : floating point number of the appropriate typeThe largest representable number.適當(dāng)類型的浮點(diǎn)數(shù)可表示的最大數(shù)字。maxexp : intThe smallest positive power of the base (2) that causes overflow.導(dǎo)致溢出的基極(2)的最小正功率。min : floating point number of the appropriate typeThe smallest representable number, typically ``-max``.適當(dāng)類型的浮點(diǎn)數(shù)最小的可表示數(shù)字,通常是“ -max”。minexp : intThe most negative power of the base (2) consistent with there beingno leading 0s in the mantissa.基數(shù)(2)的最大負(fù)冪與尾數(shù)中沒(méi)有前導(dǎo)0一致。negep : intThe exponent that yields ``epsneg``.產(chǎn)生``epsneg''的指數(shù)。nexp : intThe number of bits in the exponent including its sign and bias.指數(shù)中的位數(shù),包括其符號(hào)和偏差。nmant : intThe number of bits in the mantissa.尾數(shù)的位數(shù)。precision : intThe approximate number of decimal digits to which this kind of floatis precise.這種浮點(diǎn)數(shù)精確到的近似十進(jìn)制數(shù)字。resolution : floating point number of the appropriate typeThe approximate decimal resolution of this type, i.e.``10**-precision``.適當(dāng)類型的浮點(diǎn)數(shù)此類型的近似十進(jìn)制分辨率,即``10 **-precision''。tiny : floating point number of the appropriate typeThe smallest-magnitude usable number.適當(dāng)類型的浮點(diǎn)數(shù)最小幅度的可用數(shù)字。Parameters ---------- dtype : floating point type, dtype, or instanceThe kind of floating point data type to get information about.浮點(diǎn)類型,dtype或?qū)嵗@取有關(guān)信息的浮點(diǎn)數(shù)據(jù)類型的種類。See Also -------- numpy.lib.machar.MachAr :The implementation of the tests that produce this information. iinfo :The equivalent for integer data types.Notes ----- For developers of numpy: do not instantiate this at the module level. The initial calculation of these parameters is expensive and negatively impacts import times. These objects are cached, so calling ``finfo()`` repeatedly inside your functions is not a problem. 對(duì)于numpy的開發(fā)人員:不要在模塊級(jí)別實(shí)例化它。 這些參數(shù)的初始計(jì)算非常昂貴,并且會(huì)對(duì)導(dǎo)入時(shí)間產(chǎn)生負(fù)面影響。 這些對(duì)象被緩存,因此在函數(shù)內(nèi)重復(fù)調(diào)用finfo()不會(huì)有問(wèn)題。

示例

>>> from numpy import * >>> f = finfo(float) # the numbers given are machine dependent # 給出的數(shù)字取決于機(jī)器>>> f.nmant, f.nexp # nr of bits in the mantissa and in the exponent# 尾數(shù)和指數(shù)中的位nr (52, 11) >>> f.machep # most negative n so that 1.0 + 2**n != 1.0 -52 >>> f.eps # floating point precision: 2**machep array(2.2204460492503131e-16) >>> f.precision # nr of precise decimal digits: int(-log10(eps)) 15 >>> f.resolution # 10**(-precision) array(1.0000000000000001e-15) >>> f.negep # most negative n so that 1.0 - 2**n != 1.0 -53 >>> f.epsneg # floating point precision: 2**negep array(1.1102230246251565e-16) >>> f.minexp # most negative n so that 2**n gives normal numbers -1022 >>> f.tiny # smallest usuable floating point nr: 2**minexp array(2.2250738585072014e-308) >>> f.maxexp # smallest positive n so that 2**n causes overflow 1024 >>> f.min, f.max # the most negative and most positive usuable floating number (-1.7976931348623157e+308, array(1.7976931348623157e+308))

參考文章1:https://scipy.github.io/old-wiki/pages/Numpy_Example_List_With_Doc.html#finfo.28.29

參考文章2:Numpy : 關(guān)于np.finfo函數(shù)

參考文章3:Numpy 中文用戶指南 3.1 數(shù)據(jù)類型


參考文章4:Python第三方庫(kù)——Numpy

與50位技術(shù)專家面對(duì)面20年技術(shù)見證,附贈(zèng)技術(shù)全景圖

總結(jié)

以上是生活随笔為你收集整理的python numpy np.finfo()函数 eps的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 精品在线你懂的 | 亚州激情| 四虎综合 | av大片免费看 | 久草中文在线观看 | 国产黄频在线观看 | 欧美午夜精品久久久久久人妖 | 国产女在线 | 国产视频成人 | 久久久久无码国产精品一区 | 国内自拍区 | 特级西西人体444www高清 | 另类小说欧美 | 少妇在军营h文高辣 | 亚洲成人免费电影 | 中文字幕二区在线观看 | 久久精品国产熟女亚洲AV麻豆 | 爱情岛论坛亚洲入口 | eeuss鲁丝片一区二区三区 | 久草aⅴ | 无码人妻丰满熟妇区五十路 | www国产亚洲精品久久麻豆 | 日韩精品视频观看 | 国内精品国产成人国产三级 | 日韩a视频 | 少妇搡bbbb搡bbb搡打电话 | 亚洲精品乱码久久久久久蜜桃动漫 | 91久久精品www人人做人人爽 | 国产三级久久 | 欧美大片网站 | 精品久久久久久久久久久久久久久久久 | 奇米影视首页 | 国语播放老妇呻吟对白 | www.99re7.com| 黄色免费视频网站 | 久久福利影院 | 天海翼av | аⅴ资源中文在线天堂 | 成人av手机在线观看 | 蜜美杏av | 亚洲免费视频播放 | 国产欧美视频在线观看 | 桃谷绘里香在线观看 | 91拔萝卜视频 | 成人免费网站 | 欧美粉嫩videosex极品 | 欧美成人综合在线 | 国产成人免费av一区二区午夜 | 国产精品美女久久久久久久 | 国产精品xxx在线观看www | 欧美日韩黄色一区二区 | 色老头网址 | 国产污污在线观看 | 人妖性生活视频 | 久久99精品久久只有精品 | 毛片久久久久久久 | 99久久视频| 激情小说图片视频 | 日韩欧美爱爱 | 夜夜高潮夜夜爽国产伦精品 | 国产女优在线播放 | 亚洲成人激情小说 | 久久b | 国产一级av毛片 | 国产剧情av引诱维修工 | 欧美一区二区最爽乱淫视频免费看 | 最好看的2019年中文视频 | 狠狠操综合网 | 中文字幕精品久久久久人妻红杏ⅰ | 少妇15p| 国产激情精品一区二区三区 | 日韩在线播放一区二区 | 免费看欧美片 | 国产一级片在线播放 | 91啦中文| 91亚洲网 | 亚洲AV无码阿娇国产精品 | 99爱精品 | 亚洲天堂男人天堂 | av不卡在线免费观看 | 久草热在线 | 免费毛片大全 | 国产一区视频在线 | 天天槽| 毛片免费播放 | 成人性生交视频免费观看 | 干b视频在线观看 | 9i看片成人免费高清 | av在线播放免费 | av爱爱| 中文字幕33页 | 免费欧美一区 | 一区二区中文字幕在线观看 | 女人被灌满精子 | 日韩在线免费 | 亚洲成人精品一区二区三区 | 亚洲图片欧美 | 欧美日韩一二三四区 | 91大奶|