當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python mxnet.autograd.predict_mode用法及代碼示例

用法:

mxnet.autograd.predict_mode()

返回要在 ‘with’ 語句中使用的範圍上下文,其中前向傳遞行為設置為推理模式,而不更改記錄狀態。

例子:

with autograd.record():
    y = model(x)
    with autograd.predict_mode():
        y = sampling(y)
    backward([y])

相關用法


注:本文由純淨天空篩選整理自apache.org大神的英文原創作品 mxnet.autograd.predict_mode。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。