You need to install the right Pytorch for ROCm. You can find more info on it here:
  
      

      pytorch.org
  

  
    

PyTorch 4

  An open source machine learning framework that accelerates the path from research prototyping to production deployment.