python topk函数 默认
时间: 2023-08-21 13:10:14 浏览: 93
python topk()函数求最大和最小值实例
Python的topk函数默认是返回输入数据中特定维度上的前k个最大的元素。具体来说,torch.topk(input, k, dim=None, largest=True, sorted=True, out=None)函数中的参数largest默认为True,表示返回前k个最大值。如果将largest设置为False,则会返回前k个最小值。\[1\]
#### 引用[.reference_title]
- *1* *2* [Pytorch常用函数-topk](https://blog.csdn.net/helloworld_Fly/article/details/125107484)[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^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [【PyTorch】torch.topk() 函数详解](https://blog.csdn.net/qq_46092061/article/details/120611740)[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^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文