fix gh-2262. Fix crash cause by using cudnn when we shouldn't