一、定义 案例 二、实现 案例 import torch data=torch.randn(size=(4,10)) with torch.autograd.profiler.profile(use_cuda=True) as prof: torch.softmax(data, dim=1) print(prof.key_averages().table(sort_by="cuda_time_total", row_limit=10))