36 const float *input_data,
const float pad_value,
41 int left_padding_copy[padKernelMaxDimensionCount];
42 for (
int &i : left_padding_copy)
51 int right_padding_copy[padKernelMaxDimensionCount];
52 for (
int &i : right_padding_copy)
61 const auto extended_output =
63 const int output_batch = extended_output.dims(0);
64 const int output_plane = extended_output.dims(1);
65 const int output_height = extended_output.dims(2);
66 const int output_width = extended_output.dims(3);
67 const int output_depth = extended_output.dims(4);
69 const int left_b_padding = left_padding_copy[0];
70 const int left_p_padding = left_padding_copy[1];
71 const int left_h_padding = left_padding_copy[2];
72 const int left_w_padding = left_padding_copy[3];
73 const int left_d_padding = left_padding_copy[4];
75 const int right_b_padding = right_padding_copy[0];
76 const int right_p_padding = right_padding_copy[1];
77 const int right_h_padding = right_padding_copy[2];
78 const int right_w_padding = right_padding_copy[3];
79 const int right_d_padding = right_padding_copy[4];
81 const float *in_ptr = input_data;
82 float *out_ptr = output_data;
83 for (
int out_b = 0; out_b < output_batch; ++out_b)
85 for (
int out_p = 0; out_p < output_plane; ++out_p)
87 for (
int out_h = 0; out_h < output_height; ++out_h)
89 for (
int out_w = 0; out_w < output_width; ++out_w)
91 for (
int out_d = 0; out_d < output_depth; ++out_d)
93 if (out_b < left_b_padding || out_b >= output_batch - right_b_padding ||
94 out_p < left_p_padding || out_p >= output_plane - right_p_padding ||
95 out_h < left_h_padding || out_h >= output_height - right_h_padding ||
96 out_w < left_w_padding || out_w >= output_width - right_w_padding ||
97 out_d < left_d_padding || out_d >= output_depth - right_d_padding)
99 *out_ptr++ = pad_value;
103 *out_ptr++ = *in_ptr++;
OMStatus Pad(const core::PadParams &op_params, const core::OMRuntimeShape &input_shape, const float *input_data, const float pad_value, const core::OMRuntimeShape &output_shape, float *output_data)