torch.rand.randn
时间: 2023-09-30 11:11:39 浏览: 82
浅谈pytorch中torch.max和F.softmax函数的维度解释
torch.rand是一个函数,它返回一个张量,该张量包含了从均匀分布中随机抽取的数据。该函数可以接受一个或多个参数,用于指定张量的维度和形状。例如,torch.rand(4)会返回一个形状为(4,)的张量,其中包含了四个从均匀分布中随机抽取的数值。另外,torch.rand(2, 3)会返回一个形状为(2, 3)的张量,其中包含了从均匀分布中随机抽取的六个数值。均匀分布中随机抽取数据的函数,而torch.randn是从标准正态分布中随机抽取数据的函数。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [pyTorch.randn()、rand()、cat()、pow()、scatter_()、.squeeze() 、.unsqueeze()](https://download.csdn.net/download/weixin_38606656/14884199)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [torch.rand 和 torch.randn](https://blog.csdn.net/weixin_43102043/article/details/124489334)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [torch.rand&torch.randn介绍](https://blog.csdn.net/scar2016/article/details/115746978)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文