Error computing second derivative

Hi folks, I want to get the second derivative of a linear function w.r.t parameters but I got the error : " RuntimeError: grad can be implicitly created only for scalar outputs"

from torch.nn.utils.convert_parameters import parameters_to_vector
import torch

model_1 = torch.nn.Linear(1, 1)
x = torch.tensor([2.0], requires_grad=True)
y = model_1(x)

grads = torch.autograd.grad(y, model_1.parameters(), create_graph=True)
flat = parameters_to_vector(grads)
grad2s = torch.autograd.grad(flat, model_1.parameters())

What is the right way to compute this?
Thanks in advance