[{"metadata":{"pycharm":{"is_executing":false,"name":"#%%matplotlib inline\n"},"trusted":false},"cell_type":"raw","source":"import torch\nimport numpy\n\n#輸入shape 創(chuàng)建一個(gè)隨機(jī)的tensor,標(biāo)準(zhǔn)正態(tài)分布\na=torch.randn(2,2)\nprint(a)\n\n"},{"metadata":{"pycharm":{"is_executing":false,"name":"#%%\n"},"trusted":false},"cell_type":"markdown","source":"import torch\nimport numpy\n#輸入shape 創(chuàng)建一個(gè)隨機(jī)的tensor 隨機(jī)值在【0,1】之間 均勻分布\na=torch.rand(2,2)\nprint(a)"},{"metadata":{"pycharm":{"is_executing":false,"name":"#%%\n"},"trusted":false},"cell_type":"code","source":"import torch\nimport numpy\na=torch.rand(2,2)\n#根據(jù)一個(gè)tensor的形狀 隨機(jī)創(chuàng)建另一個(gè)tensor\nb=torch.rand_like(a)\nprint(b)","execution_count":23,"outputs":[{"name":"stdout","text":"tensor([[0.0480, 0.4929],\n [0.2032, 0.9467]])\n","output_type":"stream"}]}]
大白話說pytorch入門系列教程一:Tensor
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。
相關(guān)閱讀更多精彩內(nèi)容
- pytorch torch包 torch 包含了多維張量的數(shù)據(jù)結(jié)構(gòu)以及基于其上的多種數(shù)學(xué)操作。 函數(shù) torch....
- Tensor的創(chuàng)建除了構(gòu)造器,還提供了工廠模式的創(chuàng)建方式:函數(shù),同時(shí)提供了基本運(yùn)算函數(shù)的封裝。本主題就專門數(shù)理這些...
- PyTorch與其他框架的對比 PyTorch: 動(dòng)態(tài)計(jì)算圖 Dynamic Computation Graph ...
- 1.從本篇文章中學(xué)到最重要的概念:珍惜親情,珍惜和父母相處的時(shí)光 2.本篇文章中怦然心動(dòng)的單詞: mas...
- 因?yàn)閷W(xué)業(yè)繁忙,畫畫一直都是斷斷續(xù)續(xù)的,很久以前就很喜歡水彩,所以前不久才嘗試了一下,試著畫了一只可愛的小姐姐...