婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > pytorch常用數(shù)據(jù)類型所占字節(jié)數(shù)對照表一覽

pytorch常用數(shù)據(jù)類型所占字節(jié)數(shù)對照表一覽

熱門標(biāo)簽:廣告地圖標(biāo)注app 激戰(zhàn)2地圖標(biāo)注 唐山智能外呼系統(tǒng)一般多少錢 海南400電話如何申請 騰訊外呼線路 哈爾濱ai外呼系統(tǒng)定制 白銀外呼系統(tǒng) 陜西金融外呼系統(tǒng) 公司電話機(jī)器人

PyTorch上的常用數(shù)據(jù)類型如下

Data type dtype CPU tensor GPU tensor Size/bytes
32-bit floating torch.float32 or torch.float torch.FloatTensor torch.cuda.FloatTensor 4
64-bit floating torch.float64 or torch.double torch.DoubleTensor torch.cuda.DoubleTensor 8
16-bit floating torch.float16or torch.half torch.HalfTensor torch.cuda.HalfTensor -
8-bit integer (unsigned) torch.uint8 torch.ByteTensor torch.cuda.ByteTensor 1
8-bit integer (signed) torch.int8 torch.CharTensor torch.cuda.CharTensor -
16-bit integer (signed) torch.int16or torch.short torch.ShortTensor torch.cuda.ShortTensor 2
32-bit integer (signed) torch.int32 or torch.int torch.IntTensor torch.cuda.IntTensor 4
64-bit integer (signed) torch.int64 or torch.long torch.LongTensor torch.cuda.LongTensor 8

以上PyTorch中的數(shù)據(jù)類型和numpy中的相對應(yīng),占用字節(jié)大小也是一樣的

補(bǔ)充:pytorch tensor比較大小 數(shù)據(jù)類型要注意

如下

a = torch.tensor([[0, 0], [0, 0]])
print(a>=0.5)

輸出

tensor([[1, 1],

[1, 1]], dtype=torch.uint8)

結(jié)果明顯不對, 分析原因是因為, a是long類型, 而0.5是float. 0.5會被轉(zhuǎn)化為 long, 變?yōu)?. 因此結(jié)果會出錯, 做出如下修改就可以得到正確答案

正確用法:

a = torch.tensor([[0, 0], [0, 0]]).float()
print(a>=0.5)

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

您可能感興趣的文章:
  • PyTorch基本數(shù)據(jù)類型(一)
  • pytorch常見的Tensor類型詳解
  • PyTorch中Tensor的數(shù)據(jù)類型和運(yùn)算的使用
  • Pytorch 實現(xiàn)變量類型轉(zhuǎn)換

標(biāo)簽:惠州 常德 四川 上海 鷹潭 黑龍江 黔西 益陽

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《pytorch常用數(shù)據(jù)類型所占字節(jié)數(shù)對照表一覽》,本文關(guān)鍵詞  pytorch,常用,數(shù)據(jù),類型,所占,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《pytorch常用數(shù)據(jù)類型所占字節(jié)數(shù)對照表一覽》相關(guān)的同類信息!
  • 本頁收集關(guān)于pytorch常用數(shù)據(jù)類型所占字節(jié)數(shù)對照表一覽的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 二连浩特市| 克山县| 搜索| 茶陵县| 梁山县| 平谷区| 阳原县| 仁布县| 镇原县| 诸暨市| 威信县| 石台县| 五峰| 沾化县| 庆阳市| 虞城县| 察雅县| 博湖县| 东源县| 彭州市| 宣威市| 宣化县| 屏边| 嘉义县| 收藏| 武夷山市| 石狮市| 平度市| 阳春市| 当阳市| 正镶白旗| 弥渡县| 西城区| 德化县| 石泉县| 罗田县| 泰和县| 汉阴县| 固始县| 广河县| 山东|