Handle empty tensors in CUDA InstanceNormalization (#31647)
This pull request improves the handling of empty input tensors in the
CUDA implementation of the `InstanceNormalization` operator and adds
corresponding unit tests to ensure correct behavior. The main focus is
to ensure compliance with the ONNX specification, which allows empty
inputs and expects empty outputs.
**CUDA Implementation Improvements:**
* Updated `InstanceNorm<T>::ComputeInternal` and
`InstanceNorm<MLFloat16>::ComputeInternal` in `instance_norm.cc` to
check for empty input tensors and return early, ensuring that empty
inputs produce empty outputs as required by ONNX. This prevents
unnecessary computation and potential errors when the input size is
zero.
[[1]](diffhunk://#diff-73a0784b2867dc534a1ee23c7e624c87fd59cdbe0996dc1df8684191244ac688R49-R54)
[[2]](diffhunk://#diff-73a0784b2867dc534a1ee23c7e624c87fd59cdbe0996dc1df8684191244ac688R183-R188)
**Unit Test Additions:**
* Added two CUDA-specific tests in `instance_norm_op_test.cc`:
* `InstanceNormEmptyChannel_Cuda` verifies correct handling when the
channel dimension is zero.
* `InstanceNormEmptyBatch_Cuda` verifies correct handling when the batch
dimension is zero.
These tests confirm that the operator returns empty outputs without
error for these edge cases.
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>