[VPU] Added support for 2 axis for MVN layer - duplicate (#6748)

* [VPU]Added support for 2 axis for MVN layer

Co-authored-by: Polina <polina.brzezinskaya@intel.com>
This commit is contained in:
Daria Mityagina 2021-07-22 19:56:55 +03:00 committed by GitHub
parent 1ebdcb1d71
commit 8ba64b14c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 5 deletions

View File

@ -6,14 +6,14 @@ include_guard(GLOBAL)
set(VPU_SUPPORTED_FIRMWARES usb-ma2x8x pcie-ma2x8x)
set(VPU_SUPPORTED_FIRMWARES_HASH
"d55a824838accec31733e4d4c45e8774bdd5690da8beefe41360f1983476e3d0"
"61797a77b38fc677be4cc63d730e8871bbf169686b88eabb7066b01f9d156129")
"54a732b5fb17a0124652bc5113fa628c718a5af40621bca309471cb5ffd9271b"
"5750b2831c77ef54b8e243d3840c5ed1c9509681d55aee7e369d558cef628735")
#
# Default packages
#
set(FIRMWARE_PACKAGE_VERSION 1714)
set(FIRMWARE_PACKAGE_VERSION 1717)
set(VPU_CLC_MA2X8X_VERSION "movi-cltools-20.09.2")
#

View File

@ -48,10 +48,12 @@ private:
void serializeParamsImpl(BlobSerializer& serializer) const override {
auto normalize = attrs().get<int>("normalize");
auto across_channels = attrs().get<int>("across_channels");
auto across_width = attrs().get<int>("across_width");
auto eps = attrs().get<float>("eps");
serializer.append(static_cast<int32_t>(normalize));
serializer.append(static_cast<int32_t>(across_channels));
serializer.append(static_cast<int32_t>(across_width));
serializer.append(static_cast<float>(eps));
}
@ -88,11 +90,13 @@ void FrontEnd::parseMVN(const Model& model, const ie::CNNLayerPtr& layer, const
for (int i = 0; i < indicesSize; i++) {
axes.insert(getDimFromAxis(ndims, indicesPtr[i]));
}
const auto width = axes.count(Dim::W);
VPU_THROW_UNLESS(!axes.count(Dim::N) && axes.count(Dim::H) && axes.count(Dim::W),
VPU_THROW_UNLESS(!axes.count(Dim::N) && width,
"Unsupported combination of indices in layer \"%s\". "
"Only across channel and full batch supported.", layer->name);
"Only across channel, width and full batch supported.", layer->name);
const auto acrossChannels = axes.count(Dim::C) != 0;
const auto acrossWidth = width == 1 && axes.count(Dim::H) == 0;
const auto normVariance = layer->GetParamAsBool("normalize_variance");
const auto eps = layer->GetParamAsFloat("eps");
@ -104,6 +108,7 @@ void FrontEnd::parseMVN(const Model& model, const ie::CNNLayerPtr& layer, const
auto stage = model->addNewStage<MVNStage>(layer->name, StageType::MVN, layer, inputs, outputs);
stage->attrs().set<int>("normalize", normVariance);
stage->attrs().set<int>("across_channels", acrossChannels);
stage->attrs().set<int>("across_width", acrossWidth);
stage->attrs().set<float>("eps", eps);
}

View File

@ -15,6 +15,8 @@ const std::vector<std::vector<int>> indices_4D = {
};
const std::vector<std::vector<int>> indices_3D = {
{2},
{0, 2},
{1, 2}, // equivalent MVN-1 across_channel=0
{0, 1, 2} // equivalent MVN-1 across_channel=1
};