This other thread might also be useful.

  
    
    
    Building PyTorch with ROCm 
  
  
    So I’m building PyTorch from source and the caffe2 subrepo is still using old hiprng libraries 
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
hiprng_LIBRARIES
    linked by target "caffe2_hip" in directory /home/thomas/code/pytorch/caffe2
hipsparse_LIBRARIES
    linked by target "caffe2_hip" in directory /home/thomas/code/pytorch/caffe2

-- Configuring incomplete, err…