26#include "PALTransposeConv.h"
40constexpr int kWeightTensorIdx = 1;
41constexpr int kInputTensorIdx = 2;
42constexpr int kBiasTensorIdx = 3;
43constexpr int kOutputTensorIdx = 0;
54 const circle::Tensor *
input;
55 const circle::Tensor *weight;
56 const circle::Tensor *
output;
63 const circle::TransposeConvOptions *
options;
72 weight = runtime_kernel.
inputs[kWeightTensorIdx];
74 assert(input !=
nullptr);
75 assert(weight !=
nullptr);
77 assert(output !=
nullptr);
79 status = runtime_kernel.
getDataFromStorage(op_index, runtime_storage, runtime_context);
84 weight_data = runtime_kernel.
inputs_data[kWeightTensorIdx];
85 bias_data = runtime_kernel.
inputs_data[kBiasTensorIdx];
87 assert(input_data !=
nullptr);
88 assert(weight_data !=
nullptr);
90 assert(output_data !=
nullptr);
97 int32_t padding_h = 0;
98 int32_t padding_w = 0;
103 const int input_width = input_shape.dims(2);
104 const int input_height = input_shape.dims(1);
105 const int weight_width = weight_shape.dims(2);
106 const int weight_height = weight_shape.dims(1);
110 input_width, weight_height, weight_width,
options->padding(),
111 &padding_h, &padding_w);
113 switch (
input->type())
116 case circle::TensorType_FLOAT32:
121 ¶ms.activation_min, ¶ms.activation_max);
122 params.stride_w =
options->stride_w();
123 params.stride_h =
options->stride_h();
124 params.dilation_width_factor = 1;
125 params.dilation_height_factor = 1;
126 params.pad_h = padding_h;
127 params.pad_w = padding_w;
133 ¶ms, input_shape, core::utils::castInputData<float>(input_data), weight_shape,
134 core::utils::castInputData<float>(weight_data),
135 core::utils::castInputData<float>(bias_data),
OMRuntimeShape(output),
136 core::utils::castOutputData<float>(output_data));
137 assert(status ==
Ok);
144 assert(
false &&
"Unsupported type.");
uint8_t * outputs_data[maxOutputSize]
const circle::Operator * first_operator
OMStatus getDataFromStorage(uint16_t op_index, core::OMRuntimeStorage &storage, core::OMRuntimeContext &context)
uint8_t * inputs_data[maxInputSize]
OMStatus readKernel(uint16_t op_index, core::OMRuntimeContext &runtime_context)
const circle::Tensor * outputs[maxOutputSize]
const circle::Tensor * inputs[maxInputSize]
OMStatus TransposeConv< float >(const core::FloatConv2D *params, const core::OMRuntimeShape &input_shape, const float *input_data, const core::OMRuntimeShape &filter_shape, const float *filter_data, const float *bias_data, const core::OMRuntimeShape &output_shape, float *output_data)
OMStatus calculateActivationRange(circle::ActivationFunctionType activation, T *activation_min, T *activation_max)
void computePaddingHeightWidth(int32_t stride_height, int32_t stride_width, int32_t dilation_rate_height, int32_t dilation_rate_width, int32_t in_height, int32_t in_width, int32_t filter_height, int32_t filter_width, circle::Padding padding, int32_t *padding_h, int32_t *padding_w)
core::OMRuntimeContext & runtime_context
core::OMRuntimeStorage & runtime_storage