hxtorch.spiking.modules.BatchDropout

class hxtorch.spiking.modules.BatchDropout(size: int, dropout: float, experiment: Experiment)

Bases: hxtorch.spiking.modules.hx_module.HXFunctionalModule

Batch dropout layer

Caveat: In-place operations on TensorHandles are not supported. Must be placed after a neuron layer, i.e. Neuron.

__init__(size: int, dropout: float, experiment: Experiment)None

Initialize BatchDropout layer. This layer disables spiking neurons in the previous spiking Neuron layer with a probability of dropout. Note, size has to be equal to the size in the corresponding spiking layer. The spiking mask is maintained for the whole batch.

Parameters
  • size – Size of the population this dropout layer is applied to.

  • dropout – Probability that a neuron in the precessing layer gets disabled during training.

  • experiment – Experiment to append layer to.

Methods

__init__(size, dropout, experiment)

Initialize BatchDropout layer.

extra_repr()

Add additional information

forward_func(input)

set_mask()

Creates a new random dropout mask, applied to the spiking neurons in the previous module.

Attributes

mask

Getter for spike mask.

extra_repr()str

Add additional information

forward_func(input: hxtorch.spiking.handle.NeuronHandle)hxtorch.spiking.handle.NeuronHandle
property mask

Getter for spike mask.

Returns

Returns the current spike mask.

output_type

alias of hxtorch.spiking.handle.NeuronHandle

set_mask()None

Creates a new random dropout mask, applied to the spiking neurons in the previous module. If module.eval() dropout will be disabled.

Returns

Returns a random boolean spike mask of size self.size.