A simple hook based implementation of "Deep Networks with Stochastic Depth" for torchvision resnets.
Project description
Stochastic Depth with PyTorch Hooks
A simple hook based implementation of Deep Networks with Stochastic Depth for torchvision resnets.
Example
import torch
import torchvision.models as models
resnet = models.resnet152(pretrained=False)
resnet.train()
from stochdepth import uniform
hooks = uniform(resnet, p=0.2)
x = torch.zeros((8, 3, 224, 224), dtype=torch.float32)
y = resnet(x)
# remove hooks
for h in hooks:
h.remove()
from stochdepth import resnet_linear
hooks = resnet_linear(resnet)
y = resnet(x)
# remove hooks
for h in hooks:
h.remove()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
stochdepth-0.5.0.tar.gz
(3.0 kB
view details)
File details
Details for the file stochdepth-0.5.0.tar.gz
.
File metadata
- Download URL: stochdepth-0.5.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf612c9f84e0825f1db75e0c2fdfe40c94f2e2879002007e6d03b95b2fe5ff35 |
|
MD5 | 55814871bd4d014e1a6d3fa93df3bb3a |
|
BLAKE2b-256 | 3268227a3355c88fbde99ed25dd8f0d1bfef071fc30b2b46e9127014d5ebce51 |