: m_TargetWidth(0)
, m_TargetHeight(0)
, m_DataLayout(DataLayout::NCHW)
+ , m_AlignCorners(false)
+ , m_HalfPixelCenters(false)
{}
/// Target width value.
uint32_t m_TargetHeight;
/// The data layout to be used (NCHW, NHWC).
DataLayout m_DataLayout;
+ /// Aligned corners
+ bool m_AlignCorners;
+ /// Half Pixel Centers
+ bool m_HalfPixelCenters;
};
/// A ResizeDescriptor for the ResizeLayer.
, m_TargetHeight(0)
, m_Method(ResizeMethod::NearestNeighbor)
, m_DataLayout(DataLayout::NCHW)
- , m_BilinearAlignCorners(false)
+ , m_AlignCorners(false)
, m_HalfPixelCenters(false)
{}
m_TargetHeight == rhs.m_TargetHeight &&
m_Method == rhs.m_Method &&
m_DataLayout == rhs.m_DataLayout &&
- m_BilinearAlignCorners == rhs.m_BilinearAlignCorners &&
+ m_AlignCorners == rhs.m_AlignCorners &&
m_HalfPixelCenters == rhs.m_HalfPixelCenters;
}
ResizeMethod m_Method;
/// The data layout to be used (NCHW, NHWC).
DataLayout m_DataLayout;
- /// Aligned corners for bilinear method
- bool m_BilinearAlignCorners;
+ /// Aligned corners
+ bool m_AlignCorners;
/// Half Pixel Centers
bool m_HalfPixelCenters;
};
const char* name)
{
ResizeDescriptor resizeDescriptor;
- resizeDescriptor.m_Method = ResizeMethod::Bilinear;
- resizeDescriptor.m_DataLayout = descriptor.m_DataLayout;
- resizeDescriptor.m_TargetWidth = descriptor.m_TargetWidth;
- resizeDescriptor.m_TargetHeight = descriptor.m_TargetHeight;
+ resizeDescriptor.m_Method = ResizeMethod::Bilinear;
+ resizeDescriptor.m_DataLayout = descriptor.m_DataLayout;
+ resizeDescriptor.m_TargetWidth = descriptor.m_TargetWidth;
+ resizeDescriptor.m_TargetHeight = descriptor.m_TargetHeight;
+ resizeDescriptor.m_AlignCorners = descriptor.m_AlignCorners;
+ resizeDescriptor.m_HalfPixelCenters = descriptor.m_HalfPixelCenters;
return m_Graph->AddLayer<ResizeLayer>(resizeDescriptor, name);
}
descriptor.m_TargetHeight = flatBufferDescriptor->targetHeight();
descriptor.m_Method = ToResizeMethod(flatBufferDescriptor->method());
descriptor.m_DataLayout = ToDataLayout(flatBufferDescriptor->dataLayout());
+ descriptor.m_AlignCorners = flatBufferDescriptor->alignCorners();
+ descriptor.m_HalfPixelCenters = flatBufferDescriptor->halfPixelCenters();
auto layerName = GetLayerName(graph, layerIndex);
IConnectableLayer* layer = m_Network->AddResizeLayer(descriptor, layerName.c_str());
descriptor.m_TargetHeight = flatBufferDescriptor->targetHeight();
descriptor.m_Method = armnn::ResizeMethod::Bilinear;
descriptor.m_DataLayout = ToDataLayout(flatBufferDescriptor->dataLayout());
+ descriptor.m_AlignCorners = flatBufferDescriptor->alignCorners();
+ descriptor.m_HalfPixelCenters = flatBufferDescriptor->halfPixelCenters();
auto layerName = GetLayerName(graph, layerIndex);
IConnectableLayer* layer = m_Network->AddResizeLayer(descriptor, layerName.c_str());
targetWidth:uint;
targetHeight:uint;
dataLayout:DataLayout;
+ alignCorners:bool;
+ halfPixelCenters:bool;
}
table SliceLayer {
targetWidth:uint;
method:ResizeMethod = NearestNeighbor;
dataLayout:DataLayout;
+ alignCorners:bool;
+ halfPixelCenters:bool;
}
table StackLayer {
CreateResizeBilinearDescriptor(m_flatBufferBuilder,
resizeDescriptor.m_TargetWidth,
resizeDescriptor.m_TargetHeight,
- GetFlatBufferDataLayout(resizeDescriptor.m_DataLayout));
+ GetFlatBufferDataLayout(resizeDescriptor.m_DataLayout),
+ resizeDescriptor.m_AlignCorners,
+ resizeDescriptor.m_HalfPixelCenters);
auto flatBufferLayer = serializer::CreateResizeBilinearLayer(m_flatBufferBuilder,
flatBufferBaseLayer,
resizeDescriptor.m_TargetHeight,
resizeDescriptor.m_TargetWidth,
GetFlatBufferResizeMethod(resizeDescriptor.m_Method),
- GetFlatBufferDataLayout(resizeDescriptor.m_DataLayout));
+ GetFlatBufferDataLayout(resizeDescriptor.m_DataLayout),
+ resizeDescriptor.m_AlignCorners,
+ resizeDescriptor.m_HalfPixelCenters);
auto flatBufferLayer = serializer::CreateResizeLayer(m_flatBufferBuilder,
flatBufferBaseLayer,
desc.m_TargetWidth = 4;
desc.m_TargetHeight = 2;
desc.m_Method = armnn::ResizeMethod::NearestNeighbor;
+ desc.m_AlignCorners = true;
+ desc.m_HalfPixelCenters = true;
armnn::INetworkPtr network = armnn::INetwork::Create();
armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
{
VerifyNameAndConnections(layer, name);
- BOOST_CHECK(descriptor.m_Method == armnn::ResizeMethod::Bilinear);
- BOOST_CHECK(descriptor.m_TargetWidth == m_Descriptor.m_TargetWidth);
- BOOST_CHECK(descriptor.m_TargetHeight == m_Descriptor.m_TargetHeight);
- BOOST_CHECK(descriptor.m_DataLayout == m_Descriptor.m_DataLayout);
+ BOOST_CHECK(descriptor.m_Method == armnn::ResizeMethod::Bilinear);
+ BOOST_CHECK(descriptor.m_TargetWidth == m_Descriptor.m_TargetWidth);
+ BOOST_CHECK(descriptor.m_TargetHeight == m_Descriptor.m_TargetHeight);
+ BOOST_CHECK(descriptor.m_DataLayout == m_Descriptor.m_DataLayout);
+ BOOST_CHECK(descriptor.m_AlignCorners == m_Descriptor.m_AlignCorners);
+ BOOST_CHECK(descriptor.m_HalfPixelCenters == m_Descriptor.m_HalfPixelCenters);
}
void VisitResizeBilinearLayer(const armnn::IConnectableLayer*,
armnn::ResizeBilinearDescriptor desc;
desc.m_TargetWidth = 4u;
desc.m_TargetHeight = 2u;
+ desc.m_AlignCorners = true;
+ desc.m_HalfPixelCenters = true;
armnn::INetworkPtr network = armnn::INetwork::Create();
armnn::IConnectableLayer* const inputLayer = network->AddInputLayer(0);
const auto & operatorPtr = m_Model->subgraphs[subgraphIndex]->operators[operatorIndex];
const auto * options = operatorPtr->builtin_options.AsResizeBilinearOptions();
- desc.m_BilinearAlignCorners = options->align_corners;
+ desc.m_AlignCorners = options->align_corners;
break;
}
case ResizeMethod::NearestNeighbor:
arm_compute::PixelValue(0.f),
arm_compute::SamplingPolicy::TOP_LEFT,
true,
- descriptor.m_BilinearAlignCorners);
+ descriptor.m_AlignCorners);
}
ClResizeWorkload::ClResizeWorkload(const ResizeQueueDescriptor& descriptor, const WorkloadInfo& info) :
arm_compute::PixelValue(0.f),
arm_compute::SamplingPolicy::TOP_LEFT,
true,
- descriptor.m_Parameters.m_BilinearAlignCorners);
+ descriptor.m_Parameters.m_AlignCorners);
};
void ClResizeWorkload::Execute() const
arm_compute::PixelValue(0.f),
arm_compute::SamplingPolicy::TOP_LEFT,
true,
- descriptor.m_Parameters.m_BilinearAlignCorners);
+ descriptor.m_Parameters.m_AlignCorners);
};
void NeonResizeWorkload::Execute() const
outputInfo,
m_Data.m_Parameters.m_DataLayout,
m_Data.m_Parameters.m_Method,
- m_Data.m_Parameters.m_BilinearAlignCorners);
+ m_Data.m_Parameters.m_AlignCorners);
}
} //namespace armnn