捷徑

torch.Tensor.module_load

Tensor.module_load(other, assign=False)[原始碼][原始碼]

定義在 load_state_dict() 中將 other 載入到 self 時,該如何轉換 other

get_swap_module_params_on_conversion()True 時使用。

預期 selfnn.Module 中的參數或緩衝區,而 other 是狀態字典中具有相應鍵的值,此方法定義在透過 load_state_dict() 中的 swap_tensors()self 交換之前,other 該如何重新映射。

注意

此方法應始終返回一個不是 selfother 的新物件。 例如,如果 assignFalse,則預設實現返回 self.copy_(other).detach() ;如果 assignTrue,則返回 other.detach()

參數

文件

存取 PyTorch 的完整開發者文件

檢視文件

教學

取得針對初學者和進階開發者的深入教學

檢視教學

資源

尋找開發資源並取得您問題的解答

檢視資源