Move _has_cuda-dependent statements to inside function/object creation.