Move the asserts in shape functions upsample_nearest_2d op. (#85801)
The assert check are moved to top and the function now returns out. This is needed by the downstream torch-mlir project to correctly determine the output type.
Fixes #ISSUE_NUMBER
Pull Request resolved: https://github.com/pytorch/pytorch/pull/85801
Approved by: https://github.com/eellison