Handle zero-channel ConvTranspose inputs (#33064)
This pull request improves the handling of edge cases and memory safety
in the `ConvTranspose` operator, particularly when the number of input
channels is zero and when working with large tensor dimensions. The main
changes include adding explicit handling for zero input channels,
updating buffer size calculations to prevent overflows, and introducing
a new test to verify correct behavior in these scenarios.
**Edge case handling and correctness improvements:**
* Added explicit handling for cases where `num_input_channels == 0` in
both the templated `ConvTranspose<T>::DoConvTranspose` and the
`ConvTranspose<float>::DoConvTranspose` implementations. The output
tensor is now correctly filled with the bias value (or zeros if no bias
is present), ensuring proper behavior for this edge case.
[[1]](diffhunk://#diff-0dcb5a9c8ba0c4e67940e9d77f77cb706bbf82d67bf6757967099b0a69c797b5R147-R172)
[[2]](diffhunk://#diff-0dcb5a9c8ba0c4e67940e9d77f77cb706bbf82d67bf6757967099b0a69c797b5R261-R286)
**Memory safety and buffer calculation:**
* Updated buffer size calculations in both implementations to use
`SafeInt` and `narrow` for safe casting and multiplication, preventing
potential integer overflows with large tensor dimensions.
[[1]](diffhunk://#diff-0dcb5a9c8ba0c4e67940e9d77f77cb706bbf82d67bf6757967099b0a69c797b5R147-R172)
[[2]](diffhunk://#diff-0dcb5a9c8ba0c4e67940e9d77f77cb706bbf82d67bf6757967099b0a69c797b5R261-R286)
**Testing improvements:**
* Added a new unit test `ZeroInputChannelsWithLargeSpatialDimensions` to
verify correct behavior when the number of input channels is zero and
the spatial dimensions are very large, ensuring the operator handles
these scenarios without errors or overflows.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>