Check exception messages in embedding_bag_proxy unit test
Summary:
This replaces the use of `assertRaises` with `assertRaisesRegex` to make sure that we catch the expected exceptions.
It also corrects a few unit tests:
* Test for the case where `input is 2D and offsets is not None` was wrong.
* Check for `empty offsets` was missing.
* Check for `offsets length when include_last_offset=True` was wrong.
Test Plan:
```
buck test mode/opt caffe2/torch/fb/training_toolkit/common/proxy_module_thrift/tests:test_embedding_bag_proxy
✓ ListingSuccess: caffe2/torch/fb/training_toolkit/common/proxy_module_thrift/tests:test_embedding_bag_proxy - main (3.049)
✓ Pass: caffe2/torch/fb/training_toolkit/common/proxy_module_thrift/tests:test_embedding_bag_proxy - test_module_swapping_py (caffe2.torch.fb.training_toolkit.common.proxy_module_thrift.tests.test_embedding_bag_proxy.EmbeddingBagProxyTest) (1.084)
✓ Pass: caffe2/torch/fb/training_toolkit/common/proxy_module_thrift/tests:test_embedding_bag_proxy - test_bad_inputs (caffe2.torch.fb.training_toolkit.common.proxy_module_thrift.tests.test_embedding_bag_proxy.EmbeddingBagProxyTest) (1.164)
✓ Pass: caffe2/torch/fb/training_toolkit/common/proxy_module_thrift/tests:test_embedding_bag_proxy - test_module_swapping_jit (caffe2.torch.fb.training_toolkit.common.proxy_module_thrift.tests.test_embedding_bag_proxy.EmbeddingBagProxyTest) (1.388)
Summary
Pass: 3
ListingSuccess: 1
Finished test run: https://www.internalfb.com/intern/testinfra/testrun/4222124700133860
buck test caffe2/test:nn
Pass: 1086
Skip: 1099
Timeout: 3
Omit: 1
{emoji:2702} caffe2/test:nn - test_conv_double_backward (test_nn.TestNN)
ListingSuccess: 1
Finished test run: https://www.internalfb.com/intern/testinfra/testrun/6755399476551597
buck test caffe2/benchmarks/static_runtime:static_runtime_cpptest
✓ ListingSuccess: caffe2/benchmarks/static_runtime:static_runtime_cpptest - main (7.985)
✓ Pass: caffe2/benchmarks/static_runtime:static_runtime_cpptest - StaticRuntime.TrivialModel (12.349)
✓ Pass: caffe2/benchmarks/static_runtime:static_runtime_cpptest - StaticRuntime.LongModel (12.805)
✓ Pass: caffe2/benchmarks/static_runtime:static_runtime_cpptest - StaticRuntime.IndividualOps_to (12.890)
✓ Pass: caffe2/benchmarks/static_runtime:static_runtime_cpptest - StaticRuntime.IndividualOps_pow (13.329)
✓ Pass: caffe2/benchmarks/static_runtime:static_runtime_cpptest - StaticRuntime.EmbeddingBag (13.703)
✓ Pass: caffe2/benchmarks/static_runtime:static_runtime_cpptest - StaticRuntime.IndividualOps_Reshape (13.886)
✓ Pass: caffe2/benchmarks/static_runtime:static_runtime_cpptest - StaticRuntime.LeakyReLU (13.964)
✓ Pass: caffe2/benchmarks/static_runtime:static_runtime_cpptest - StaticRuntime.IndividualOps_Binary (13.967)
✓ Pass: caffe2/benchmarks/static_runtime:static_runtime_cpptest - StaticRuntime.DeepWide (14.095)
✓ Pass: caffe2/benchmarks/static_runtime:static_runtime_cpptest - StaticRuntime.KWargsAPI_1 (14.461)
✓ Pass: caffe2/benchmarks/static_runtime:static_runtime_cpptest - StaticRuntime.UnaryOps (14.527)
✓ Pass: caffe2/benchmarks/static_runtime:static_runtime_cpptest - StaticRuntime.CleanUpMemory (14.624)
✓ Pass: caffe2/benchmarks/static_runtime:static_runtime_cpptest - StaticRuntime.FusionPass (14.635)
✓ Pass: caffe2/benchmarks/static_runtime:static_runtime_cpptest - StaticRuntime.KWargsAPI_2 (15.027)
✓ Pass: caffe2/benchmarks/static_runtime:static_runtime_cpptest - StaticRuntime.IndividualOps_flatten (15.299)
Summary
Pass: 15
ListingSuccess: 1
Finished test run: https://www.internalfb.com/intern/testinfra/testrun/5348024606957775
```
Reviewed By: qizzzh
Differential Revision: D27415247
fbshipit-source-id: c4915170e89359ea961c1a6df513b29790f147fa