param.stride = stride;
// TODO : Extract this to a function
- const auto padding_type = node.param().padding;
+ const auto padding_type = node.param().padding.type;
param.padding = [&]() {
if (padding_type != model::PaddingType::EXPLICIT) // implicit padding
{
param.stride = stride;
// TODO : Extract this to a function
- const auto padding_type = node.param().padding;
+ const auto padding_type = node.param().padding.type;
param.padding = [&]() {
if (padding_type != model::PaddingType::EXPLICIT) // implicit padding
{
param.stride.horizontal = hstride;
// TODO : Extract this to a function
- const auto padding_type = node.param().padding;
+ const auto padding_type = node.param().padding.type;
param.padding = [&]() {
if (padding_type != model::PaddingType::EXPLICIT) // implicit padding
{
param.stride.horizontal = hstride;
// TODO : Extract this to a function
- const auto padding_type = node.param().padding;
+ const auto padding_type = node.param().padding.type;
param.padding = [&]() {
if (padding_type != model::PaddingType::EXPLICIT) // implicit padding
{
param.stride = stride;
// TODO : Extract this to a function
- const auto padding_type = node.param().padding;
+ const auto padding_type = node.param().padding.type;
param.padding = [&]() {
if (padding_type != model::PaddingType::EXPLICIT) // implicit padding
{
param.stride.horizontal = hstride;
param.stride.vertical = vstride;
- const auto padding_type = node.param().padding;
+ const auto padding_type = node.param().padding.type;
assert((padding_type == model::PaddingType::SAME) || (padding_type == model::PaddingType::VALID));
param.padding =
(padding_type == model::PaddingType::SAME)
param.stride = stride;
// TODO : Extract this to a function
- const auto padding_type = node.param().padding;
+ const auto padding_type = node.param().padding.type;
param.padding = [&]() {
if (padding_type != model::PaddingType::EXPLICIT) // implicit padding
{
param.stride = stride;
// TODO : Extract this to a function
- const auto padding_type = node.param().padding;
+ const auto padding_type = node.param().padding.type;
param.padding = [&]() {
if (padding_type != model::PaddingType::EXPLICIT) // implicit padding
{
param.stride.horizontal = hstride;
// TODO : Extract this to a function
- const auto padding_type = node.param().padding;
+ const auto padding_type = node.param().padding.type;
param.padding = [&]() {
if (padding_type != model::PaddingType::EXPLICIT) // implicit padding
{
param.stride.horizontal = hstride;
// TODO : Extract this to a function
- const auto padding_type = node.param().padding;
+ const auto padding_type = node.param().padding.type;
param.padding = [&]() {
if (padding_type != model::PaddingType::EXPLICIT) // implicit padding
{
param.stride = stride;
// TODO : Extract this to a function
- const auto padding_type = node.param().padding;
+ const auto padding_type = node.param().padding.type;
param.padding = [&]() {
if (padding_type != model::PaddingType::EXPLICIT) // implicit padding
{
param.stride = stride;
// TODO : Extract this to a function
- const auto padding_type = node.param().padding;
+ const auto padding_type = node.param().padding.type;
param.padding = [&]() {
if (padding_type != model::PaddingType::EXPLICIT) // implicit padding
{
param.stride.horizontal = hstride;
// TODO : Extract this to a function
- const auto padding_type = node.param().padding;
+ const auto padding_type = node.param().padding.type;
param.padding = [&]() {
if (padding_type != model::PaddingType::EXPLICIT) // implicit padding
{
param.stride.horizontal = hstride;
// TODO : Extract this to a function
- const auto padding_type = node.param().padding;
+ const auto padding_type = node.param().padding.type;
param.padding = [&]() {
if (padding_type != model::PaddingType::EXPLICIT) // implicit padding
{
#ifndef __NEURUN_MODEL_INTERNAL_TYPE_H__
#define __NEURUN_MODEL_INTERNAL_TYPE_H__
+#include <cstdint>
+
namespace neurun
{
namespace model
VALID = 2
};
+// TODO merge with neurun::util::Padding struct
+struct ExplicitPadding
+{
+ int32_t left;
+ int32_t right;
+ int32_t top;
+ int32_t bottom;
+};
+
+// TODO Resolve explicit padding value at frontend and save in value field
+struct Padding
+{
+ PaddingType type;
+ ExplicitPadding value;
+};
+
} // namespace model
} // namespace neurun
OperandIndex hstride_index;
OperandIndex vstride_index;
- PaddingType padding;
+ Padding padding;
OperandIndex padding_left_index;
OperandIndex padding_right_index;
OperandIndex hstride_index;
OperandIndex vstride_index;
- PaddingType padding;
+ Padding padding;
OperandIndex padding_left_index;
OperandIndex padding_right_index;
OperandIndex hstride_index;
OperandIndex vstride_index;
- PaddingType padding;
+ Padding padding;
OperandIndex padding_left_index;
OperandIndex padding_right_index;
struct Param
{
- PaddingType padding;
+ Padding padding;
OperandIndex padding_left_index;
OperandIndex padding_right_index;
OperandIndex hstride_index;
OperandIndex vstride_index;
- PaddingType padding;
+ Padding padding;
OperandIndex padding_left_index;
OperandIndex padding_right_index;
struct Param
{
- PaddingType padding;
+ Padding padding;
OperandIndex hstride_index;
OperandIndex vstride_index;
};
assert(vstride > 0);
assert(hstride > 0);
- assert((node.param().padding == model::PaddingType::SAME) ||
- (node.param().padding == model::PaddingType::VALID));
+ assert((node.param().padding.type == model::PaddingType::SAME) ||
+ (node.param().padding.type == model::PaddingType::VALID));
assert(ifm_shape.N == ofm_shape.N);
assert(ifm_shape.C == ker_shape.C);
assert(ker_shape.N == ofm_shape.C);
void Dumper::visit(const Conv2DNode &node)
{
std::string padding_type =
- node.param().padding == model::PaddingType::EXPLICIT ? "Explicit" : "Implicit";
+ node.param().padding.type == model::PaddingType::EXPLICIT ? "Explicit" : "Implicit";
VERBOSE(LIR) << "* Conv2D(" << padding_type << ")" << std::endl;
VERBOSE(LIR) << " - Inputs : IFM(" << node.getInputs().at(Conv2DNode::Input::INPUT).value()
<< ") Kernel(" << node.getInputs().at(Conv2DNode::Input::KERNEL).value() << ") Bias("
void Dumper::visit(const DepthwiseConv2DNode &node)
{
std::string padding_type =
- node.param().padding == model::PaddingType::EXPLICIT ? "Explicit" : "Implicit";
+ node.param().padding.type == model::PaddingType::EXPLICIT ? "Explicit" : "Implicit";
VERBOSE(LIR) << "* DepthwiseConv2D(" << padding_type << ")" << std::endl;
VERBOSE(LIR) << " - Inputs : IFM("
<< node.getInputs().at(DepthwiseConv2DNode::Input::INPUT).value() << ") Kernel("
void Dumper::visit(const MaxPool2DNode &node)
{
std::string padding_type =
- node.param().padding == model::PaddingType::EXPLICIT ? "Explicit" : "Implicit";
+ node.param().padding.type == model::PaddingType::EXPLICIT ? "Explicit" : "Implicit";
VERBOSE(LIR) << "* MaxPool2D(" << padding_type << ")" << std::endl;
VERBOSE(LIR) << " - Inputs : IFM(" << node.getInputs().at(MaxPool2DNode::Input::INPUT).value()
<< ")" << std::endl;
void Dumper::visit(const TransposeConvNode &node)
{
std::string padding_type =
- node.param().padding == model::PaddingType::EXPLICIT ? "Explicit" : "Implicit";
+ node.param().padding.type == model::PaddingType::EXPLICIT ? "Explicit" : "Implicit";
VERBOSE(LIR) << "* TransposeConv(" << padding_type << ")" << std::endl;
VERBOSE(LIR) << " - Inputs : Output Shape("
<< node.getInputs().at(TransposeConvNode::Input::OUTPUT_SHAPE).value() << ") KERNEL("
const auto padding_index = OperandIndex{init_param.inputs[3]};
const auto activation_index = OperandIndex{init_param.inputs[7]};
- param.padding =
+ param.padding.type =
NNAPIConvert::getPaddingType(operands.at(padding_index).asScalar<PaddingCode>());
param.hstride_index = OperandIndex{init_param.inputs[4]};
param.vstride_index = OperandIndex{init_param.inputs[5]};
const auto activation_index = OperandIndex{init_param.inputs[10]};
- param.padding = PaddingType::EXPLICIT;
+ param.padding.type = PaddingType::EXPLICIT;
param.padding_left_index = OperandIndex{init_param.inputs[3]};
param.padding_right_index = OperandIndex{init_param.inputs[4]};
param.padding_top_index = OperandIndex{init_param.inputs[5]};
const auto padding_index = OperandIndex{init_param.inputs[1]};
const auto activation_index = OperandIndex{init_param.inputs[6]};
- param.padding =
+ param.padding.type =
NNAPIConvert::getPaddingType(operands.at(padding_index).asScalar<PaddingCode>());
param.hstride_index = OperandIndex{init_param.inputs[2]};
const auto activation_index = OperandIndex{init_param.inputs[9]};
- param.padding = PaddingType::EXPLICIT;
+ param.padding.type = PaddingType::EXPLICIT;
param.padding_left_index = OperandIndex{init_param.inputs[1]};
param.padding_right_index = OperandIndex{init_param.inputs[2]};
const auto padding_index = OperandIndex{init_param.inputs[1]};
const auto activation_index = OperandIndex{init_param.inputs[6]};
- param.padding =
+ param.padding.type =
NNAPIConvert::getPaddingType(operands.at(padding_index).asScalar<PaddingCode>());
param.hstride_index = OperandIndex{init_param.inputs[2]};
param.vstride_index = OperandIndex{init_param.inputs[3]};
auto activation_index = OperandIndex{init_param.inputs[9]};
- param.padding = PaddingType::EXPLICIT;
+ param.padding.type = PaddingType::EXPLICIT;
param.padding_left_index = OperandIndex{init_param.inputs[1]};
param.padding_right_index = OperandIndex{init_param.inputs[2]};
const auto padding_index = OperandIndex{init_param.inputs[3]};
const auto activation_index = OperandIndex{init_param.inputs[6]};
- param.padding =
+ param.padding.type =
NNAPIConvert::getPaddingType(operands.at(padding_index).asScalar<PaddingCode>());
param.hstride_index = OperandIndex{init_param.inputs[4]};
param.vstride_index = OperandIndex{init_param.inputs[5]};
const auto activation_index = OperandIndex{init_param.inputs[6]};
- param.padding = PaddingType::EXPLICIT;
+ param.padding.type = PaddingType::EXPLICIT;
param.padding_left_index = OperandIndex{init_param.inputs[3]};
param.padding_right_index = OperandIndex{init_param.inputs[4]};
param.padding_top_index = OperandIndex{init_param.inputs[5]};
const auto padding_index = OperandIndex{init_param.inputs[1]};
const auto activation_index = OperandIndex{init_param.inputs[6]};
- param.padding =
+ param.padding.type =
NNAPIConvert::getPaddingType(operands.at(padding_index).asScalar<PaddingCode>());
param.hstride_index = OperandIndex{init_param.inputs[2]};
param.vstride_index = OperandIndex{init_param.inputs[3]};
// 9 -> FuseCode (activation) Index
const auto activation_index = OperandIndex{init_param.inputs[9]};
- param.padding = PaddingType::EXPLICIT;
+ param.padding.type = PaddingType::EXPLICIT;
param.padding_left_index = OperandIndex{init_param.inputs[1]};
param.padding_right_index = OperandIndex{init_param.inputs[2]};
param.padding_top_index = OperandIndex{init_param.inputs[3]};
operation::TransposeConvNode::Param param;
auto padding_index = OperandIndex{init_param.inputs[3]};
- param.padding =
+ param.padding.type =
NNAPIConvert::getPaddingType(operands.at(padding_index).asScalar<PaddingCode>());
param.hstride_index = OperandIndex{init_param.inputs[4]};
param.vstride_index = OperandIndex{init_param.inputs[5]};
IndexSet inputs{input_operand, kernel_operand, bias_operand};
GraphNode::Param conv_params;
- conv_params.padding = neurun::model::PaddingType::SAME;
+ conv_params.padding.type = neurun::model::PaddingType::SAME;
conv_params.hstride_index = model.operands.append(shape, type);
conv_params.vstride_index = model.operands.append(shape, type);
conv_params.activation = neurun::model::Activation::NONE;