This appears to be an OSX thing.
On Linux/gcc, we get very reasonable error and backtrace:
terminate called after throwing an instance of 'c10::Error'
  what():  Expected object of scalar type double but got scalar type long int for argument 'other'
Exception raised from cpu_equal at ../aten/src/ATen/native/ReduceOps.cpp:1230 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) + 0x55 (0x7fc78e452055 in /usr/local/lib/python3.9/dist-packages/torch/lib/libc10.so)
frame #1: <unknown function> + 0x66de24 (0x7fc78eae4e24 in /usr/local/lib/python3.9/dist-packages/torch/lib/libtorch_cpu.so)
...

Maybe on OSX you need to do your own exception catching and what printing (or have a compilation flag that adds that for you or something, I would not know).
Best regards
Thomas