[PT] add check for duplicated op names in JIT (#41549)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/41549
D22467871 (https://github.com/pytorch/pytorch/commit/a548c6b18ff5a337b6329ed7b2381cfb4d3da2ed) was reverted due to double linking torch_mobile_train.
Re-do this change after D22531358 (https://github.com/pytorch/pytorch/commit/7a33d8b001b1f8dc59c07d0701d615093a81a741).
Test Plan:
buck install fb4a
Train mnist in Internal Settings.
Reviewed By: iseeyuan
Differential Revision: D22533824
fbshipit-source-id: b36884531d41cea2e76b7fb1a567f21106c612b6