ConvShapeUtils
Single source of truth for convolution output-shape arithmetic.
Both eager execution (VoidTensorOps) and graph emission (Conv{1,2,3}dOperation.inferOutputs) must produce identical shapes; keeping the formula here prevents the two paths from diverging.
Functions
Link copied to clipboard
Link copied to clipboard
fun conv2dOutputShape(inputShape: IntArray, weightShape: IntArray, stride: Pair<Int, Int>, padding: Pair<Int, Int>, dilation: Pair<Int, Int>): IntArray
Conv2d output shape: input (batch, in_channels, height, width), weight (out_channels, in_channels_per_group, kernel_h, kernel_w), result (batch, out_channels, out_h, out_w).
Link copied to clipboard
fun conv3dOutputShape(inputShape: IntArray, weightShape: IntArray, stride: Triple<Int, Int, Int>, padding: Triple<Int, Int, Int>, dilation: Triple<Int, Int, Int>): IntArray
Conv3d output shape: input (batch, in_channels, depth, height, width), weight (out_channels, in_channels_per_group, kernel_d, kernel_h, kernel_w), result (batch, out_channels, out_d, out_h, out_w).
Link copied to clipboard
Link copied to clipboard