Module: TorchVision::Models::ResNet18
- Defined in:
- lib/torchvision/models/resnet18.rb
Class Method Summary collapse
Class Method Details
.new(pretrained: false, **kwargs) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/torchvision/models/resnet18.rb', line 4 def self.new(pretrained: false, **kwargs) model = ResNet.new(BasicBlock, [2, 2, 2, 2], **kwargs) if pretrained url = "https://download.pytorch.org/models/resnet18-5c106cde.pth" state_dict = Torch::Hub.load_state_dict_from_url(url) model.load_state_dict(state_dict) end model end |