MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ComputePaddingWithOffset

Function ComputePaddingWithOffset

tensorflow/lite/kernels/padding.h:32–41  ·  view source on GitHub ↗

It's not guaranteed that padding is symmetric. It's important to keep offset for algorithms need all paddings.

Source from the content-addressed store, hash-verified

30// It's not guaranteed that padding is symmetric. It's important to keep
31// offset for algorithms need all paddings.
32inline int ComputePaddingWithOffset(int stride, int dilation_rate, int in_size,
33 int filter_size, int out_size,
34 int* offset) {
35 int effective_filter_size = (filter_size - 1) * dilation_rate + 1;
36 int total_padding =
37 ((out_size - 1) * stride + effective_filter_size - in_size);
38 total_padding = total_padding > 0 ? total_padding : 0;
39 *offset = total_padding % 2;
40 return total_padding / 2;
41}
42
43// Matching GetWindowedOutputSize in TensorFlow.
44inline int ComputeOutSize(TfLitePadding padding, int image_size,

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected