Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ size_t CNNNetworkHelper::getInputChannelsCount(const CNNLayer& layer) {
return insertData->getDims()[1];
}
default: {
THROW_IE_EXCEPTION << "Not supported layout " << insertData->getLayout();
return insertData->getDims()[1];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can insertData->getDims().size() be 1 (insertData->getLayout() == Layout::C)? Does it mean that this line fails?

}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,14 @@ void MKLDNNDepthwiseNode::getSupportedDescriptors() {
internalBlobs.push_back(createInternalBlob(weightDims, false));
}

for (auto format : getAvailableFormatsForDims(parentOutDims)) {
MKLDNNMemoryDesc in_candidate{parentOutDims, inputDataType, format};
if (parentOutDims.ndims() == 6) {
MKLDNNMemoryDesc in_candidate{parentOutDims, inputDataType, memory::format::blocked};
createDescriptor({in_candidate}, {});
} else {
for (auto format : getAvailableFormatsForDims(parentOutDims)) {
MKLDNNMemoryDesc in_candidate{parentOutDims, inputDataType, format};
createDescriptor({in_candidate}, {});
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#include <vector>

#include "subgraph_tests/multiply_add.hpp"

using namespace LayerTestsDefinitions;

namespace {

const std::vector<InferenceEngine::Precision> netPrecisions = {
InferenceEngine::Precision::FP32
};

INSTANTIATE_TEST_CASE_P(MultipleAdd, MultiplyAddLayerTest,
::testing::Combine(
::testing::Values(std::vector<size_t >({1, 3, 2, 2, 4, 5})),
::testing::ValuesIn(netPrecisions),
::testing::Values(CommonTestUtils::DEVICE_CPU)),
MultiplyAddLayerTest::getTestCaseName);

} // namespace
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once

#include <tuple>
#include <string>
#include <vector>
#include <memory>
#include "functional_test_utils/layer_test_utils.hpp"
#include "ngraph_functions/builders.hpp"
#include "ngraph_functions/utils/ngraph_helpers.hpp"
#include "common_test_utils/test_constants.hpp"

namespace LayerTestsDefinitions {

using MultiplyAddParamsTuple = typename std::tuple<
std::vector<size_t>, //input shapes
InferenceEngine::Precision, //Network precision
std::string>; //Device name

class MultiplyAddLayerTest:
public testing::WithParamInterface<MultiplyAddParamsTuple>,
public LayerTestsUtils::LayerTestsCommon{
public:
std::shared_ptr<ngraph::Function> fn;
static std::string getTestCaseName(const testing::TestParamInfo<MultiplyAddParamsTuple> &obj);
protected:
void SetUp() override;
};

} // namespace LayerTestsDefinitions
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright (C) 2020 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//

#include <tuple>
#include <string>
#include <vector>
#include <memory>
#include <functional>
#include <debug.h>
#include "ie_core.hpp"
#include "common_test_utils/common_utils.hpp"
#include "functional_test_utils/blob_utils.hpp"
#include "functional_test_utils/precision_utils.hpp"
#include "functional_test_utils/plugin_cache.hpp"
#include "functional_test_utils/skip_tests_config.hpp"
#include "subgraph_tests/multiply_add.hpp"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: typically we put corresponding header in the first


namespace LayerTestsDefinitions {
std::string MultiplyAddLayerTest::getTestCaseName(const testing::TestParamInfo<MultiplyAddParamsTuple> &obj) {
std::vector<size_t> inputShapes;
InferenceEngine::Precision netPrecision;
std::string targetName;
std::tie(inputShapes, netPrecision, targetName) = obj.param;
std::ostringstream results;

results << "IS=" << CommonTestUtils::vec2str(inputShapes) << "_";
results << "netPRC=" << netPrecision.name() << "_";
results << "targetDevice=" << targetName << "_";
return results.str();
}

void MultiplyAddLayerTest::SetUp() {
std::vector<size_t> inputShape;
auto netPrecision = InferenceEngine::Precision::UNSPECIFIED;
std::tie(inputShape, netPrecision, targetDevice) = this->GetParam();
auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision);
auto params = ngraph::builder::makeParams(ngPrc, {inputShape});
auto paramOuts = ngraph::helpers::convert2OutputVector(
ngraph::helpers::castOps2Nodes<ngraph::op::Parameter>(params));

std::vector<size_t> constShape(inputShape.size(), 1);
constShape[1] = inputShape[1];

auto const_mul = ngraph::builder::makeConstant(ngPrc, constShape, std::vector<float>{-1.0f, 2.0f, -3.0f});
auto mul = std::make_shared<ngraph::opset3::Multiply>(paramOuts[0], const_mul);
auto const_add = ngraph::builder::makeConstant(ngPrc, constShape, std::vector<float>{1.0f, -2.0f, 3.0f});
auto add = std::make_shared<ngraph::opset3::Add>(mul, const_add);
ngraph::ResultVector results{std::make_shared<ngraph::opset3::Result>(add)};
function = std::make_shared<ngraph::Function>(results, params, "multiplyAdd");
}

TEST_P(MultiplyAddLayerTest, CompareWithRefs) {
Run();
};
} // namespace LayerTestsDefinitions