| 35 | |
| 36 | struct PadContext { |
| 37 | PadContext(TfLiteContext* context, TfLiteNode* node) { |
| 38 | input = GetInput(context, node, 0); |
| 39 | paddings = GetInput(context, node, 1); |
| 40 | if (NumInputs(node) == 3) { |
| 41 | constant_values = GetOptionalInputTensor(context, node, 2); |
| 42 | } else { |
| 43 | constant_values = nullptr; |
| 44 | } |
| 45 | output = GetOutput(context, node, 0); |
| 46 | dims = NumDimensions(input); |
| 47 | |
| 48 | resizing_category = ResizingCategory::kGenericResize; |
| 49 | const int paddings_total = GetTensorShape(paddings).FlatSize(); |
| 50 | const int32* paddings_data = GetTensorData<int32>(paddings); |
| 51 | // Paddings will be a n,2 array, and we need to detect 4D arrays with the |
| 52 | // pattern { {0,0}, {a, b}, {c, d}, {0,0} }. |
| 53 | if (IsConstantTensor(paddings) && paddings_total == 8 && |
| 54 | (paddings_data[0] == 0 && paddings_data[1] == 0) && |
| 55 | (paddings_data[6] == 0 && paddings_data[7] == 0)) { |
| 56 | resizing_category = ResizingCategory::kImageStyle; |
| 57 | } |
| 58 | } |
| 59 | const TfLiteTensor* constant_values; |
| 60 | const TfLiteTensor* input; |
| 61 | const TfLiteTensor* paddings; |
nothing calls this directly
no test coverage detected