tensorflow中的數(shù)據(jù)類型dtype用法說明
Tensorflow中,主要有以下幾種數(shù)據(jù)類型(dtype),在舊版本中,不用加tf也能使用。
有符號整型
tf.int8:8位整數(shù)。
tf.int16:16位整數(shù)。
tf.int32:32位整數(shù)。
tf.int64:64位整數(shù)。
無符號整型
tf.uint8:8位無符號整數(shù)。
tf.uint16:16位無符號整數(shù)。
浮點型
tf.float16:16位浮點數(shù)。
tf.float32:32位浮點數(shù)。
tf.float64:64位浮點數(shù)。
tf.double:等同于tf.float64。
字符串型
tf.string:字符串。
布爾型
tf.bool:布爾型。
復數(shù)型
tf.complex64:64位復數(shù)。
tf.complex128:128位復數(shù)。
補充:tensorflow及numpy的數(shù)據(jù)類型對象Dtype總結(jié)
1.dtyte與astype
dtype:查看數(shù)據(jù)類型
astype:轉(zhuǎn)換數(shù)據(jù)類型
2.tensorlow數(shù)據(jù)類型對象Dtype
名稱 | 描述 |
---|---|
tf.float16 | 16位半精度浮點 |
tf.float32 | 32位單精度浮點 |
tf.float64 | 64位雙精度浮點 |
tf.bfloat16 | 16位截斷浮點 |
tf.complex64 | 64位單精度復數(shù) |
tf.complex128 | 128位雙精度復數(shù) |
tf.int8 | 8位有符號整數(shù) |
tf.uint8 | 8位無符號整數(shù) |
tf.uint16 | 16位無符號整數(shù) |
tf.int16 | 16位有符號整數(shù) |
tf.int32 | 32位有符號整數(shù) |
tf.int64 | 64位有符號整數(shù) |
tf.bool | 布爾值 |
tf.string | 字符串 |
tf.qint8 | 量化的8位帶符號整數(shù) |
tf.quint8 | 量化的8位無符號整數(shù) |
tf.qint16 | 量化的16位有符號整數(shù) |
tf.quint16 | 量化的16位無符號整數(shù) |
tf.qint32 | 量化的32位有符號整數(shù) |
tf.as_dtype()函數(shù)將numpy類型和字符串類型名稱轉(zhuǎn)換為DType對象。
3.numpy數(shù)據(jù)類型對象dtype
名稱 | 描述 |
---|---|
np.bool_ | 布爾型數(shù)據(jù)類型 |
np.int_ | 默認的整數(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位無符號整數(shù)(0 to 255) |
np.uint16 | 16位無符號整數(shù)(0 to 65535) |
np.uint32 | 32位無符號整數(shù)(0 to 4294967295) |
np.uint64 | 64位無符號整數(shù)(0 to 18446744073709551615) |
np.float_ | float64 簡寫,即64位雙精度浮點數(shù) |
np.float16 | 16位半精度浮點數(shù),包括:1 個符號位,5 個指數(shù)位,10 個尾數(shù)位 |
np.float32 | 32位 單精度浮點數(shù),包括:1 個符號位,8 個指數(shù)位,23 個尾數(shù)位 |
np.float64 | 64位雙精度浮點數(shù),包括:1 個符號位,11 個指數(shù)位,52 個尾數(shù)位 |
np.complex_ | complex128 簡寫,即 128 位復數(shù) |
np.complex64 | 復數(shù),表示雙 32 位浮點數(shù)(實數(shù)部分和虛數(shù)部分) |
np.complex128 | 復數(shù),表示雙 64 位浮點數(shù)(實數(shù)部分和虛數(shù)部分) |
以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關(guān)文章
flask使用session保存登錄狀態(tài)及攔截未登錄請求代碼
這篇文章主要介紹了flask使用session保存登錄狀態(tài)及攔截未登錄請求代碼,具有一定借鑒價值,需要的朋友可以參考下2018-01-01使用Python?matplotlib繪制簡單的柱形圖、折線圖和直線圖
Matplotlib是Python的繪圖庫, 它可與NumPy一起使用,提供了一種有效的MatLab開源替代方案,下面這篇文章主要給大家介紹了關(guān)于使用Python?matplotlib繪制簡單的柱形圖、折線圖和直線圖的相關(guān)資料,需要的朋友可以參考下2022-08-08如何利用Python處理excel表格中的數(shù)據(jù)
Excel做為職場人最常用的辦公軟件,具有方便、快速、批量處理數(shù)據(jù)的特點,下面這篇文章主要給大家介紹了關(guān)于如何利用Python處理excel表格中數(shù)據(jù)的相關(guān)資料,需要的朋友可以參考下2022-03-03