29 const float *input_data,
const float *pad_value_ptr,
37 left_padding_copy[i] = 0;
47 right_padding_copy[i] = 0;
54 const auto extended_output =
56 const int output_batch = extended_output.dims(0);
57 const int output_plane = extended_output.dims(1);
58 const int output_height = extended_output.dims(2);
59 const int output_width = extended_output.dims(3);
60 const int output_depth = extended_output.dims(4);
62 const int left_b_padding = left_padding_copy[0];
63 const int left_p_padding = left_padding_copy[1];
64 const int left_h_padding = left_padding_copy[2];
65 const int left_w_padding = left_padding_copy[3];
66 const int left_d_padding = left_padding_copy[4];
68 const int right_b_padding = right_padding_copy[0];
69 const int right_p_padding = right_padding_copy[1];
70 const int right_h_padding = right_padding_copy[2];
71 const int right_w_padding = right_padding_copy[3];
72 const int right_d_padding = right_padding_copy[4];
74 const float pad_value = *pad_value_ptr;
76 const float *in_ptr = input_data;
77 float *out_ptr = output_data;
78 for (
int out_b = 0; out_b < output_batch; ++out_b)
80 for (
int out_p = 0; out_p < output_plane; ++out_p)
82 for (
int out_h = 0; out_h < output_height; ++out_h)
84 for (
int out_w = 0; out_w < output_width; ++out_w)
86 for (
int out_d = 0; out_d < output_depth; ++out_d)
88 if (out_b < left_b_padding || out_b >= output_batch - right_b_padding ||
89 out_p < left_p_padding || out_p >= output_plane - right_p_padding ||
90 out_h < left_h_padding || out_h >= output_height - right_h_padding ||
91 out_w < left_w_padding || out_w >= output_width - right_w_padding ||
92 out_d < left_d_padding || out_d >= output_depth - right_d_padding)
94 *out_ptr++ = pad_value;
98 *out_ptr++ = *in_ptr++;
void Pad(const PadParams &op_params, const luci_interpreter::RuntimeShape &input_shape, const float *input_data, const float *pad_value_ptr, const luci_interpreter::RuntimeShape &output_shape, float *output_data)