zhihu還不錯的相關(guān)介紹 不過按這個文章的說法 加速原理是開始會搜索并緩存最優(yōu)的卷積結(jié)構(gòu)局荚,如果輸入尺寸一直變的話二汛,還可能變慢蔼紧,看看yolov5的寫法
def init_seeds(seed=0):
torch.manual_seed(seed)
# Speed-reproducibility tradeoff https://pytorch.org/docs/stable/notes/randomness.html
if seed == 0: # slower, more reproducible
cudnn.deterministic = True
cudnn.benchmark = False
else: # faster, less reproducible
cudnn.deterministic = False
cudnn.benchmark = True
v5中seed取1狭姨,不過v5的img_size固定了宰啦,不像v3