torch.random.choice
时间: 2023-10-23 21:30:24 浏览: 530
torch.random.choice是一个PyTorch中用于从给定的一维数组中随机选择元素的函数。它的用法是torch.random.choice(a[, size, replace, p]),其中a是一维数组,size是要选择的元素个数,replace表示是否允许重复选择元素,p是一个与a相同长度的概率数组,用于指定每个元素被选择的概率。如果不指定size,默认只选择一个元素。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [python 基本语法——随机数的生成 torch & numpy](https://blog.csdn.net/qq_44783177/article/details/114236344)[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: 50%"]
- *3* [PyTorch的torch.cat用法](https://download.csdn.net/download/weixin_38653040/12850385)[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: 50%"]
[ .reference_list ]
阅读全文