[fix] EmbeddingBag segfault for out-of-bounds idx (#71904)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/71094
Added checks for out-of-bound indices
Pull Request resolved: https://github.com/pytorch/pytorch/pull/71904
Reviewed By: jbschlosser, VitalyFedyunin
Differential Revision: D33893387
Pulled By: ngimel
fbshipit-source-id: 0ba7038bd7e10c6fa6700646a0fe755b73db0ec9
(cherry picked from commit 4d6ae2e3f4ed73e243fe39f49f575433752d6ab1)