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

Function GetPaddedOutputShape

tensorflow/lite/kernels/mirror_pad.cc:148–160  ·  view source on GitHub ↗

Returns the shape of the final output after padding.

Source from the content-addressed store, hash-verified

146
147// Returns the shape of the final output after padding.
148std::unique_ptr<TfLiteIntArray, void (*)(TfLiteIntArray*)> GetPaddedOutputShape(
149 const TfLiteTensor* input, const TfLiteTensor* padding_matrix) {
150 const int input_dims = NumDimensions(input);
151 std::unique_ptr<TfLiteIntArray, void (*)(TfLiteIntArray*)> shape(
152 TfLiteIntArrayCreate(input_dims), TfLiteIntArrayFree);
153
154 int64_t left_pad = 0, right_pad = 0;
155 for (int i = 0; i < input_dims; ++i) {
156 GetPadding(padding_matrix, i, &left_pad, &right_pad);
157 shape->data[i] = SizeOfDimension(input, i) + left_pad + right_pad;
158 }
159 return shape;
160}
161
162} // namespace
163

Callers 2

EvalFunction · 0.85
PrepareFunction · 0.85

Calls 4

NumDimensionsFunction · 0.85
TfLiteIntArrayCreateFunction · 0.85
SizeOfDimensionFunction · 0.85
GetPaddingFunction · 0.70

Tested by

no test coverage detected