[ONNX] Relax node constraint for onnx shape inference (#77379)
None as input is legal per ONNX spec for representing
optional inputs. For [example](https://github.com/onnx/onnx/blob/main/docs/Operators.md#inputs-2---3-7) `constant_value` for `ONNX::Pad`.
This PR removes such constraint check that was set prior
to calling onnx shape inference. For the issue below, such
constraint prevents the onnx shape inference of `ONNX::Pad`,
which leads to falling back on an incorrect constant traced
shape.
For the unit test in this PR, prior to this PR, the ONNX shape inference
for `ONNX::Pad` would be skipped, and would return `None` instead.
Fixes https://github.com/pytorch/vision/issues/5971
Pull Request resolved: https://github.com/pytorch/pytorch/pull/77379
Approved by: https://github.com/garymm