braincog package

Subpackages

Submodules

braincog.utils module

class braincog.utils.AverageMeter

基类:object

reset()
update(val, n=1)
class braincog.utils.TensorGather

基类:object

reset()
update(val)
braincog.utils.accuracy(output, target, topk=(1,))

Compute the top1 and top5 accuracy

braincog.utils.adjust_surrogate_coeff(epoch, tot_epochs)
braincog.utils.calc_aurc(confidences, labels)
braincog.utils.mse(x, y)
braincog.utils.rand_ortho(shape, irange)
braincog.utils.random_gradient(model: Module, sigma: float)

为梯度添加噪声 :param model: 模型 :param sigma: 噪声方差 :return:

braincog.utils.save_feature_map(x, dir='')
braincog.utils.save_spike_info(fname, epoch, batch_idx, step, avg, var, spike, avg_per_step)

对spike-info格式进行调整, 便于保存 :param fname: 输出文件名 :param epoch: epoch :param batch_idx: batch index :param step: 仿真步长 :param avg: 平均脉冲发放率 :param var: 脉冲发放率的方差 :param spike: :param avg_per_step: :return:

braincog.utils.setup_seed(seed)

为CPU,GPU,所有GPU,numpy,python设置随机数种子,并禁止hash随机化 :param seed: seed value :return:

Module contents