hgq.layers.snn package
Submodules
hgq.layers.snn.base module
- class hgq.layers.snn.base.ATan(alpha: float = 2.0)
Bases:
objectArc-tangent surrogate gradient for a Heaviside spike function.
- get_config()
- class hgq.layers.snn.base.LIFCell(*args, **kwargs)
Bases:
SpikingNeuralCellLeaky integrate-and-fire RNN cell.
- build(input_shape)
- call(inputs, states, training=None)
- get_config()
Returns the config of the object.
An object config is a Python dictionary (serializable) containing the information needed to re-instantiate it.
- class hgq.layers.snn.base.QLIF(*args, **kwargs)
Bases:
_QSNNQuantization-aware leaky integrate-and-fire sequence layer.
- get_config()
Returns the config of the object.
An object config is a Python dictionary (serializable) containing the information needed to re-instantiate it.
- class hgq.layers.snn.base.QLIFCell(*args, **kwargs)
Bases:
QSimpleSNNCellQuantization-aware leaky integrate-and-fire RNN cell.
- property beta_q
- build(input_shape)
- call(inputs, states, training=None)
- get_config()
Returns the config of the object.
An object config is a Python dictionary (serializable) containing the information needed to re-instantiate it.
- property qlif_beta
- class hgq.layers.snn.base.QSimpleSNN(*args, **kwargs)
Bases:
_QSNNQuantization-aware integrate-and-fire sequence layer.
- get_config()
Returns the config of the object.
An object config is a Python dictionary (serializable) containing the information needed to re-instantiate it.
- class hgq.layers.snn.base.QSimpleSNNCell(*args, **kwargs)
Bases:
QLayerBaseSingleInput,SpikingNeuralCellQuantization-aware integrate-and-fire RNN cell.
The membrane accumulator is not quantized by default. Input, emitted spikes, scalar parameters, and optionally recurrent state may be quantized.
- build(input_shape)
- call(inputs, states, training=None)
- property enable_ebops
- property enable_sq
- fire(mem)
- get_config()
Returns the config of the object.
An object config is a Python dictionary (serializable) containing the information needed to re-instantiate it.
- property graded_spikes_factor_q
- property qgraded_spikes_factor
- reset(mem, spk)
- property sq
- class hgq.layers.snn.base.SpikingNeuralCell(*args, **kwargs)
Bases:
LayerIntegrate-and-fire RNN cell.
- build(input_shape)
- call(inputs, states, training=None)
- fire(mem)
- classmethod from_config(config)
Creates an operation from its config.
This method is the reverse of get_config, capable of instantiating the same operation from the config dictionary.
Note: If you override this method, you might receive a serialized dtype config, which is a dict. You can deserialize it as follows:
```python if “dtype” in config and isinstance(config[“dtype”], dict):
policy = dtype_policies.deserialize(config[“dtype”])
- Parameters:
config – A Python dictionary, typically the output of get_config.
- Returns:
An operation instance.
- get_config()
Returns the config of the object.
An object config is a Python dictionary (serializable) containing the information needed to re-instantiate it.
- get_initial_state(batch_size=None)
- reset(mem, spk)
- reset_mechanisms = ('subtract', 'zero', 'none')
- hgq.layers.snn.base.atan(alpha: float = 2.0)
Return an arc-tangent surrogate gradient callable.
Module contents
- class hgq.layers.snn.ATan(alpha: float = 2.0)
Bases:
objectArc-tangent surrogate gradient for a Heaviside spike function.
- get_config()
- class hgq.layers.snn.LIFCell(*args, **kwargs)
Bases:
SpikingNeuralCellLeaky integrate-and-fire RNN cell.
- build(input_shape)
- call(inputs, states, training=None)
- get_config()
Returns the config of the object.
An object config is a Python dictionary (serializable) containing the information needed to re-instantiate it.
- class hgq.layers.snn.QLIF(*args, **kwargs)
Bases:
_QSNNQuantization-aware leaky integrate-and-fire sequence layer.
- get_config()
Returns the config of the object.
An object config is a Python dictionary (serializable) containing the information needed to re-instantiate it.
- class hgq.layers.snn.QLIFCell(*args, **kwargs)
Bases:
QSimpleSNNCellQuantization-aware leaky integrate-and-fire RNN cell.
- property beta_q
- build(input_shape)
- call(inputs, states, training=None)
- get_config()
Returns the config of the object.
An object config is a Python dictionary (serializable) containing the information needed to re-instantiate it.
- property qlif_beta
- class hgq.layers.snn.QSimpleSNN(*args, **kwargs)
Bases:
_QSNNQuantization-aware integrate-and-fire sequence layer.
- get_config()
Returns the config of the object.
An object config is a Python dictionary (serializable) containing the information needed to re-instantiate it.
- class hgq.layers.snn.QSimpleSNNCell(*args, **kwargs)
Bases:
QLayerBaseSingleInput,SpikingNeuralCellQuantization-aware integrate-and-fire RNN cell.
The membrane accumulator is not quantized by default. Input, emitted spikes, scalar parameters, and optionally recurrent state may be quantized.
- build(input_shape)
- call(inputs, states, training=None)
- property enable_ebops
- property enable_sq
- fire(mem)
- get_config()
Returns the config of the object.
An object config is a Python dictionary (serializable) containing the information needed to re-instantiate it.
- property graded_spikes_factor_q
- property qgraded_spikes_factor
- reset(mem, spk)
- property sq
- class hgq.layers.snn.SpikingNeuralCell(*args, **kwargs)
Bases:
LayerIntegrate-and-fire RNN cell.
- build(input_shape)
- call(inputs, states, training=None)
- fire(mem)
- classmethod from_config(config)
Creates an operation from its config.
This method is the reverse of get_config, capable of instantiating the same operation from the config dictionary.
Note: If you override this method, you might receive a serialized dtype config, which is a dict. You can deserialize it as follows:
```python if “dtype” in config and isinstance(config[“dtype”], dict):
policy = dtype_policies.deserialize(config[“dtype”])
- Parameters:
config – A Python dictionary, typically the output of get_config.
- Returns:
An operation instance.
- get_config()
Returns the config of the object.
An object config is a Python dictionary (serializable) containing the information needed to re-instantiate it.
- get_initial_state(batch_size=None)
- reset(mem, spk)
- reset_mechanisms = ('subtract', 'zero', 'none')
- hgq.layers.snn.atan(alpha: float = 2.0)
Return an arc-tangent surrogate gradient callable.