As your code currently is:
class ShiftLayer(nn.Module):
    def __init__(self, b):
        super().__init__()
        self.b = nn.Parameter(torch.tensor(1.))
        
    def forward(self, x):
        return x + self.b

the value of b passed in to ___init___ is not used at all. So it is as good as not passing in this value. Perhaps you meant to say
self.b = nn.Parameter(torch.tensor(b))

?