Skip to main content

A simple hook based implementation of "Deep Networks with Stochastic Depth" for torchvision resnets.

Project description

Stochastic Depth with PyTorch Hooks Travis CI build status PyPI version

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)

Uploaded Source

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

Hashes for stochdepth-0.5.0.tar.gz
Algorithm Hash digest
SHA256 bf612c9f84e0825f1db75e0c2fdfe40c94f2e2879002007e6d03b95b2fe5ff35
MD5 55814871bd4d014e1a6d3fa93df3bb3a
BLAKE2b-256 3268227a3355c88fbde99ed25dd8f0d1bfef071fc30b2b46e9127014d5ebce51

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page