fix undef CUDA_VERSION warning (#37866)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/37866
make sure not to check `CUDA_VERSION` if it is not defined
Test Plan: CI gree
Reviewed By: anjali411
Differential Revision: D21408844
fbshipit-source-id: 5a9afe372b3f1fbaf08a7c43fa3e0e654a569d5f