Matching GetWindowedOutputSize in TensorFlow.
| 42 | |
| 43 | // Matching GetWindowedOutputSize in TensorFlow. |
| 44 | inline int ComputeOutSize(TfLitePadding padding, int image_size, |
| 45 | int filter_size, int stride, int dilation_rate = 1) { |
| 46 | int effective_filter_size = (filter_size - 1) * dilation_rate + 1; |
| 47 | switch (padding) { |
| 48 | case kTfLitePaddingSame: |
| 49 | return (image_size + stride - 1) / stride; |
| 50 | case kTfLitePaddingValid: |
| 51 | return (image_size + stride - effective_filter_size) / stride; |
| 52 | default: |
| 53 | return 0; |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | inline TfLitePaddingValues ComputePaddingHeightWidth( |
| 58 | int stride_height, int stride_width, int dilation_rate_height, |
no outgoing calls
no test coverage detected