[PyTorch] Improve OperatorEntry::getKernelForDispatchKey (#64838)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/64838
The returned pointer, if present, could never be nullptr, so there is no reason to wrap it in an optional rather than just using the nullptr state. The repeated calls to kernels_.at() were not getting optimized away, so just use the perfectly good iterator find() already gave us.
ghstack-source-id: 138304429
Test Plan: CI
Reviewed By: bdhirsh
Differential Revision: D30875748
fbshipit-source-id: 9cbb875715b7a582380c7402155fdbe21944dc85