torch.utils.model_zoo¶
-
torch.utils.model_zoo.load_url(url, model_dir=None, map_location=None)[source]¶ Loads the Torch serialized object at the given URL.
If the object is already present in model_dir, it’s deserialied and returned. The filename part of the URL should follow the naming convention
filename-<sha256>.extwhere<sha256>is the first eight or more digits of the SHA256 hash of the contents of the file. The hash is used to ensure unique names and to verify the contents of the file.The default value of model_dir is
$TORCH_HOME/modelswhere$TORCH_HOMEdefaults to~/.torch. The default directory can be overriden with the$TORCH_MODEL_ZOOenvironement variable.Parameters: Example
>>> state_dict = torch.utils.model_zoo.load_url('https://s3.amazonaws.com/pytorch/models/resnet18-5c106cde.pth')