| """
|
| Stub implementation for snntorch package.
|
| """
|
| import logging
|
| import torch
|
|
|
| from ._neurons import LIF, Synaptic
|
|
|
| logger = logging.getLogger(__name__)
|
| logger.info("Using minimal stub implementation of snntorch")
|
|
|
|
|
| class spikegen:
|
| @staticmethod
|
| def rate(tensor, num_steps=1, threshold=None):
|
| """Generate spikes from tensor"""
|
| if threshold is None:
|
| threshold = 0.5
|
|
|
|
|
| spikes = (tensor > threshold).float()
|
| return spikes
|
|
|
| @staticmethod
|
| def latency(tensor, num_steps=None, threshold=None, tau=1.0):
|
| """Generate spikes with latency coding"""
|
| return spikegen.rate(tensor, num_steps, threshold)
|
|
|