[GNA] Security fixes for 2021.3 (#4538)
This commit is contained in:
parent
42c1c65454
commit
1eb830d083
|
|
@ -161,7 +161,7 @@ inline std::pair<InferenceEngine::CNNLayerPtr, int> CNNNetCheckNextLayerSkipCer
|
|||
if (bOnlyCheck) return {nullptr, 0};
|
||||
THROW_GNA_LAYER_EXCEPTION(layer) << " no next output layer for outdata: " << oidx;
|
||||
}
|
||||
if (iidx >= getInputTo(layer->outData[oidx]).size()) {
|
||||
if (getInputTo(layer->outData[oidx]).empty() || iidx >= getInputTo(layer->outData[oidx]).size()) {
|
||||
if (bOnlyCheck) return {nullptr, 0};
|
||||
THROW_GNA_LAYER_EXCEPTION(layer) << " no next output layer for outdata: " << oidx << " and inputTo index: " << iidx;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -585,7 +585,7 @@ void GNAPlugin::ConvertModelLayoutFromNCHWToNHWC(const std::vector<CNNLayerPtr>
|
|||
if (InferenceEngine::CNNNetHasPrevLayer(l.get())) {
|
||||
transpositionInfo = FindTranspositionInfoFromPrevLayers(InferenceEngine::CNNNetPrevLayer(l));
|
||||
// If no convolutions are found try to find them in next layers
|
||||
if (!foundPartToTranspose(transpositionInfo)) {
|
||||
if (!foundPartToTranspose(transpositionInfo) && !l->outData.empty() && !getInputTo(l->outData[0]).empty()) {
|
||||
transpositionInfo = FindTranspositionInfoFromNextLayers(getInputTo(l->outData[0]).begin()->second);
|
||||
}
|
||||
}
|
||||
|
|
@ -662,7 +662,7 @@ void GNAPlugin::ConvertModelLayoutFromNCHWToNHWC(const std::vector<CNNLayerPtr>
|
|||
}
|
||||
// Find a convolution in previous or next layers
|
||||
auto transpositionInfo = FindTranspositionInfoFromPrevLayers(firstInput);
|
||||
if (!foundPartToTranspose(transpositionInfo)) {
|
||||
if (!foundPartToTranspose(transpositionInfo) && !l->outData.empty() && !getInputTo(l->outData[0]).empty()) {
|
||||
transpositionInfo = FindTranspositionInfoFromNextLayers(getInputTo(l->outData[0]).begin()->second);
|
||||
}
|
||||
if (!transpositionInfo.empty()) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2020 Intel Corporation
|
||||
// Copyright (C) 2020-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
|
|
@ -23,6 +23,13 @@ struct Config {
|
|||
AdjustKeyMapValues();
|
||||
}
|
||||
Config(const Config& r) {
|
||||
Copy(r);
|
||||
}
|
||||
Config& operator=(const Config& r) {
|
||||
Copy(r);
|
||||
return *this;
|
||||
}
|
||||
void Copy(const Config& r) {
|
||||
gnaPrecision = r.gnaPrecision;
|
||||
dumpXNNPath = r.dumpXNNPath;
|
||||
dumpXNNGeneration = r.dumpXNNGeneration;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2018-2020 Intel Corporation
|
||||
// Copyright (C) 2018-2021 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ class GNAMemory : public GNAMemRequestsQueue {
|
|||
size_t _rw_section_size = 0;
|
||||
size_t _ro_section_size = 0;
|
||||
Allocator _allocator;
|
||||
std::shared_ptr<uint8_t> heap;
|
||||
std::shared_ptr<uint8_t> heap = nullptr;
|
||||
size_t _page_alignment = 1;
|
||||
|
||||
class GNAMemRequestsReadOnlyQueue : public GNAMemRequestsQueue {
|
||||
|
|
|
|||
|
|
@ -678,11 +678,15 @@ void RemovePermutationsNHWCToNCHWPass::run() {
|
|||
data->setLayout(Layout::NHWC);
|
||||
};
|
||||
|
||||
auto current_layer = getInputTo(pattern_start->outData[0]).begin()->second;
|
||||
auto input_to = getInputTo(pattern_start->outData[0]);
|
||||
IE_ASSERT(!input_to.empty());
|
||||
auto current_layer = input_to.begin()->second;
|
||||
setNHWCOrder(current_layer->input());
|
||||
while (current_layer != pattern_end) {
|
||||
setNHWCOrder(current_layer->outData[0]);
|
||||
current_layer = getInputTo(current_layer->outData[0]).begin()->second;
|
||||
input_to = getInputTo(current_layer->outData[0]);
|
||||
IE_ASSERT(!input_to.empty());
|
||||
current_layer = input_to.begin()->second;
|
||||
}
|
||||
|
||||
if (LayerInfo(pattern_start).isPermute() && !getInputTo(pattern_start->outData.front()).empty()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue