You wouldn't be able to use the PyTorch as built and provided by Ubuntu, as in 'apt-get install python3-torch' [1], as that version currently only has CPU support.
You could still use a version provided by a third party, for example directly from pytorch.org, or a containerized version provided by ROCm upstream [2].