Your code works fine after fixing the tensor.ones to torch.ones and updates the buffer:
class MyModule(nn.Module):
    def __init__(self):
        super(MyModule, self).__init__()
        self.register_buffer('my_buffer', torch.zeros(1))

    def forward(self):
        self.my_buffer = torch.ones(1)
        return

model = MyModule()
print(model.my_buffer)
> tensor([0.])
model()
print(model.my_buffer)
> tensor([1.])

PS: you can post code snippets by wrapping them into three backticks ```, which makes debugging easier