I cannot find any reference in the documentation, but I suspect the way you are updating Tensorflow is not totally supported by Sagemaker. Sagemaker usually uses prebuilt containers, that already contains tensorflow, but also CUDA. If you just update Tensorflow there is no guarantee that will be still compatible with the installed CUDA.
Answer from rok on Stack OverflowAn ml.t3.2xlarge is a CPU instance which has no GPU.
Instead, run your SageMaker notebook instance with one of the GPU instances listed here, like ml.g4dn.xlarge, and make sure to pick the PyTorch kernel for the notebook.
ml.g4dn.xlarge, and make sure to pick the PyTorch kernel for the notebook.-- This worked for me
It looks like the issue is you have the cpu version of pytorch installed instead of the gpu version. If you go to the pytorch home page: https://pytorch.org/get-started/locally/ you can use the configuration table to install the cuda 11 or cuda 12 version of pytorch and you should be good to go.
Use nvidia-smi to troubleshoot. Depending on what it says, you need to get and install the nvidia cuda driver. If you've upgraded your kernel (or had it automatically applied) you need to reinstall the cuda driver.
If nvidia-smi shows correct GPU data, then something is wrong with pytorch install.