31 const float *input_data,
const Shape &filter_shape,
45 const int input_depth =
MatchingDim(input_shape, 3, filter_shape, 3);
47 const int input_height = input_shape.
Dims(1);
48 const int input_width = input_shape.
Dims(2);
49 const int filter_height = filter_shape.
Dims(1);
50 const int filter_width = filter_shape.
Dims(2);
62 for (
int i = 0; i < num_elements; i++)
64 output_data[i] = 0.0f;
68 for (
int batch = 0; batch < batches; ++batch)
70 for (
int in_y = 0; in_y < input_height; ++in_y)
72 for (
int in_x = 0; in_x < input_width; ++in_x)
74 for (
int in_channel = 0; in_channel < input_depth; ++in_channel)
77 const int out_x_origin = (in_x * stride_width) - pad_width;
78 const int out_y_origin = (in_y * stride_height) - pad_height;
79 for (
int filter_y = 0; filter_y < filter_height; ++filter_y)
81 for (
int filter_x = 0; filter_x < filter_width; ++filter_x)
83 for (
int out_channel = 0; out_channel < output_depth; ++out_channel)
86 const int out_x = out_x_origin + filter_x;
87 const int out_y = out_y_origin + filter_y;
89 if ((out_x >= 0) && (out_x < output_width) && (out_y >= 0) &&
90 (out_y < output_height))
93 input_data[
Offset(input_shape, batch, in_y, in_x, in_channel)];
95 filter_data[
Offset(filter_shape, out_channel, filter_y, filter_x, in_channel)];
97 input_value * filter_value;
void TransposeConv(const TransposeConvParams ¶ms, const Shape &input_shape, const float *input_data, const Shape &filter_shape, const float *filter_data, const Shape &output_shape, float *output_data)