load_state_dict: Load a state dict file

View source: R/save.R

load_state_dictR Documentation

Load a state dict file

Description

This function should only be used to load models saved in python. For it to work correctly you need to use torch.save with the flag: ⁠_use_new_zipfile_serialization=True⁠ and also remove all nn.Parameter classes from the tensors in the dict.

Usage

load_state_dict(path, ..., legacy_stream = FALSE)

Arguments

path

to the state dict file

...

additional arguments that are currently not used.

legacy_stream

if TRUE then the state dict is loaded using a a legacy way of handling streams.

Details

The above might change with development of this in pytorch's C++ api.

Value

a named list of tensors.


torch documentation built on June 7, 2023, 6:19 p.m.