Try this codes. it converts tensor variables to integer ones.
I confirmed that it works for your example.
n, c, h, w = x.shape
c1 = c.item()
h1 = h.item()
w1 = w.item()
y = nn.functional.layer_norm(x, [c1, h1, w1])