composer.algorithms.stochastic_depth.sample_stochastic_layers#

composer.algorithms.stochastic_depth.sample_stochastic_layers

Classes

Bottleneck

torchvision.models.resnet.Bottleneck

SampleStochasticBottleneck

Sample-wise stochastic ResNet Bottleneck block.

class composer.algorithms.stochastic_depth.sample_stochastic_layers.SampleStochasticBottleneck(drop_rate, **kwargs)[source]#

Bases: torchvision.models.resnet.Bottleneck

Sample-wise stochastic ResNet Bottleneck block.

This block has a probability of dropping samples before the identity connection, then adds back the untransformed samples using the identity connection.

Parameters
  • sample_drop_rate (float) โ€“ The probability of dropping a sample within this block. Must be between 0.0 and 1.0.

  • **kwargs โ€“ Used for the original Bottleneck initialization arguments.

static from_target_layer(module, module_index, module_count, drop_rate, drop_distribution)[source]#

Helper function to convert a ResNet Bottleneck block into a sample-wise stochastic block.