I just tested this repro with PyTorch and ONNXRuntime nightly.
The error I see is:
onnxruntime.capi.onnxruntime_pybind11_state.InvalidGraph: [ONNXRuntimeError] : 10 : INVALID_GRAPH : This is an invalid model. Type Error: Type ‘tensor(float)’ of input parameter (x) of operator (Equal) in node (Equal_3) is invalid.
However, by changing dtype to torch.int in the test, this ONNXRuntime error is no longer thrown.
Looks like ONNX Equal op takes float input data type, so this might be an issue with ONNXRuntime.
Will follow op on this.