Kernel for Pytorch Linear Regression appears to have died

I am using the following simple code to start with

import numpy as np
import matplotlib.pyplot as plt
import torch
w=torch.tensor(-10.0,requires_grad=True)
x=torch.arange(-3,3,0.1).view(-1,1)
f=-3*x

plt.plot(x.numpy(),f.numpy())
plt.show()

when I try to plot, I get an error message "Kernel for Pytorch apperas to have dies. It will restyart automatically

I tried uninstalling torchvision and reinstalling the same, but error persists

Try to run the code in a terminal to get a proper error message.