Returns the shape of the final output after padding.
| 146 | |
| 147 | // Returns the shape of the final output after padding. |
| 148 | std::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 |
no test coverage detected