欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

tensorflow中的數(shù)據(jù)類型dtype用法說明

 更新時(shí)間:2021年05月26日 14:49:45   作者:知了不知蟬鳴驚  
這篇文章主要介紹了tensorflow中的數(shù)據(jù)類型dtype用法說明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教

Tensorflow中,主要有以下幾種數(shù)據(jù)類型(dtype),在舊版本中,不用加tf也能使用。

有符號(hào)整型

tf.int8:8位整數(shù)。

tf.int16:16位整數(shù)。

tf.int32:32位整數(shù)。

tf.int64:64位整數(shù)。

無符號(hào)整型

tf.uint8:8位無符號(hào)整數(shù)。

tf.uint16:16位無符號(hào)整數(shù)。

浮點(diǎn)型

tf.float16:16位浮點(diǎn)數(shù)。

tf.float32:32位浮點(diǎn)數(shù)。

tf.float64:64位浮點(diǎn)數(shù)。

tf.double:等同于tf.float64。

字符串型

tf.string:字符串。

布爾型

tf.bool:布爾型。

復(fù)數(shù)型

tf.complex64:64位復(fù)數(shù)。

tf.complex128:128位復(fù)數(shù)。

補(bǔ)充:tensorflow及numpy的數(shù)據(jù)類型對(duì)象Dtype總結(jié)

1.dtyte與astype

dtype:查看數(shù)據(jù)類型

astype:轉(zhuǎn)換數(shù)據(jù)類型

在這里插入圖片描述

2.tensorlow數(shù)據(jù)類型對(duì)象Dtype

名稱 描述
tf.float16 16位半精度浮點(diǎn)
tf.float32 32位單精度浮點(diǎn)
tf.float64 64位雙精度浮點(diǎn)
tf.bfloat16 16位截?cái)喔↑c(diǎn)
tf.complex64 64位單精度復(fù)數(shù)
tf.complex128 128位雙精度復(fù)數(shù)
tf.int8 8位有符號(hào)整數(shù)
tf.uint8 8位無符號(hào)整數(shù)
tf.uint16 16位無符號(hào)整數(shù)
tf.int16 16位有符號(hào)整數(shù)
tf.int32 32位有符號(hào)整數(shù)
tf.int64 64位有符號(hào)整數(shù)
tf.bool 布爾值
tf.string 字符串
tf.qint8 量化的8位帶符號(hào)整數(shù)
tf.quint8 量化的8位無符號(hào)整數(shù)
tf.qint16 量化的16位有符號(hào)整數(shù)
tf.quint16 量化的16位無符號(hào)整數(shù)
tf.qint32 量化的32位有符號(hào)整數(shù)

tf.as_dtype()函數(shù)將numpy類型和字符串類型名稱轉(zhuǎn)換為DType對(duì)象。

3.numpy數(shù)據(jù)類型對(duì)象dtype

名稱 描述
np.bool_ 布爾型數(shù)據(jù)類型
np.int_ 默認(rèn)的整數(shù)類型
np.intc 與 C 的 int 類型一樣,一般是 int32 或 int 64
np.intp 用于索引的整數(shù)類型,一般是 int32 或 int64
np.int8 8位整數(shù)即1字節(jié)(-128 to 127)
np.int16 16位整數(shù)(-32768 to 32767)
np.int32 32位整數(shù)(-2147483648 to 2147483647)
np.int64 64位整數(shù)(-9223372036854775808 to 9223372036854775807)
np.uint8 8位無符號(hào)整數(shù)(0 to 255)
np.uint16 16位無符號(hào)整數(shù)(0 to 65535)
np.uint32 32位無符號(hào)整數(shù)(0 to 4294967295)
np.uint64 64位無符號(hào)整數(shù)(0 to 18446744073709551615)
np.float_ float64 簡寫,即64位雙精度浮點(diǎn)數(shù)
np.float16 16位半精度浮點(diǎn)數(shù),包括:1 個(gè)符號(hào)位,5 個(gè)指數(shù)位,10 個(gè)尾數(shù)位
np.float32 32位 單精度浮點(diǎn)數(shù),包括:1 個(gè)符號(hào)位,8 個(gè)指數(shù)位,23 個(gè)尾數(shù)位
np.float64 64位雙精度浮點(diǎn)數(shù),包括:1 個(gè)符號(hào)位,11 個(gè)指數(shù)位,52 個(gè)尾數(shù)位
np.complex_ complex128 簡寫,即 128 位復(fù)數(shù)
np.complex64 復(fù)數(shù),表示雙 32 位浮點(diǎn)數(shù)(實(shí)數(shù)部分和虛數(shù)部分)
np.complex128 復(fù)數(shù),表示雙 64 位浮點(diǎn)數(shù)(實(shí)數(shù)部分和虛數(shù)部分)

以上為個(gè)人經(jīng)驗(yàn),希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論