You are manually detaching the model output in this line of code:
out1=out.clone().detach().cpu()

so the error message is expected, since the detached tensor is not attached to any computation graph.