Example:
class MyModule(nn.Module):
def init(self):
super(QLIF_Conv2d, self).init()
self.my_buffer_tmp = torch.zeros(1)
self.register_buffer(‘my_buffer’,my_buffer_tmp)
def forward(self):
self.my_buffer = tensor.ones(1)
…
return …
I cannot get my_buffer=torch.tensor(1);
I get my_buffer=torch.tensor(1)
How to update my_buffer when forward?