随机生成torch张量
时间: 2023-09-21 14:09:54 浏览: 91
PyTorch | (2)PyTorch 入门-张量
要随机生成torch张量,可以使用torch.randn()函数生成服从标准正态分布的随机数张量。该函数可以指定生成张量的形状,例如torch.randn(2,3)会生成一个形状为(2,3)的张量,其中的元素服从标准正态分布。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [pytorch张量 张量的生成](https://blog.csdn.net/hhhhxxn/article/details/110006703)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *3* [PyTorch-1.10(三)--torch张量随机生成、采样](https://blog.csdn.net/weixin_43145427/article/details/124683835)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文