Fix warnings, cl compiler (#5641)

* Fix warnings

* make cpplint happy
This commit is contained in:
Maksim Derbasov authored and GitHub committed 2021-05-18 07:32:53 +03:00
1 parent 6a8f8a0761
commit 61108f1147
8 files changed
+31 -26

No files matched your search

@@ -9,7 +9,7 @@ using namespace MKLDNNPlugin;
impl_desc_type MKLDNNPlugin::parse_impl_name(std::string impl_desc_name) {
impl_desc_type res = impl_desc_type::unknown;
#define REPLACE_WORD(_wrd, _sub) int pos = impl_desc_name.find(#_wrd); \
#define REPLACE_WORD(_wrd, _sub) auto pos = impl_desc_name.find(#_wrd); \
if (pos != std::string::npos) impl_desc_name.replace(pos, std::string(#_wrd).length(), #_sub);
REPLACE_WORD(simple, ref);
@@ -159,7 +159,7 @@ private:
for (size_t iwork = start; iwork < end; ++iwork) {
std::vector<size_t> forStartOffset(numOfDims);
forStartOffset[axis] = 0;
for (int64_t offsetIdx = 0, countersIdx = 0; offsetIdx < numOfDims; ++offsetIdx) {
for (size_t offsetIdx = 0, countersIdx = 0; offsetIdx < numOfDims; ++offsetIdx) {
if (offsetIdx == axis) {
continue;
}
@@ -143,7 +143,7 @@ public:
InferenceEngine::SizeVector inputShapes, newInputShapes;
InferenceEngine::Precision inputPrecision, netPrecision;
std::map<std::string, std::string> expectedPrecisions;
float threshold = 2e-2; // Is enough for tensor having abs maximum values less than 1
float threshold = 2e-2f; // Is enough for tensor having abs maximum values less than 1
static std::string getTestCaseName(testing::TestParamInfo<basicParams> obj) {
InferenceEngine::Precision inputPrecision, netPrecision;
@@ -111,7 +111,7 @@ TEST_P(PreprocessTest, SetMeanImagePreProcessGetBlob) {
auto lockedMem = inBlob->buffer();
auto *inData = lockedMem.as<float*>();
for (size_t i = 0; i < inBlob->size(); i++)
inData[i] = i;
inData[i] = static_cast<float>(i);
}
req.Infer();
@@ -182,7 +182,7 @@ TEST_P(PreprocessTest, SetMeanImagePreProcessSetBlob) {
auto lockedMem = inBlob->buffer();
auto *inData = lockedMem.as<float*>();
for (size_t i = 0; i < inBlob->size(); i++)
inData[i] = i;
inData[i] = static_cast<float>(i);
}
req.Infer();
@@ -243,7 +243,7 @@ TEST_P(PreprocessTest, SetMeanValuePreProcessGetBlob) {
auto lockedMem = inBlob->buffer();
auto *inData = lockedMem.as<float*>();
for (size_t i = 0; i < inBlob->size(); i++)
inData[i] = i;
inData[i] = static_cast<float>(i);
}
req.Infer();
@@ -308,7 +308,7 @@ TEST_P(PreprocessTest, SetMeanValuePreProcessSetBlob) {
auto lockedMem = inBlob->buffer();
auto *inData = lockedMem.as<float*>();
for (size_t i = 0; i < inBlob->size(); i++)
inData[i] = i;
inData[i] = static_cast<float>(i);
}
req.Infer();
@@ -363,7 +363,7 @@ TEST_P(PreprocessTest, ReverseInputChannelsPreProcessGetBlob) {
auto lockedMem = inBlob->buffer();
auto *inData = lockedMem.as<float*>();
for (size_t i = 0; i < inBlob->size(); i++)
inData[i] = i;
inData[i] = static_cast<float>(i);
}
req.Infer();
@@ -430,7 +430,7 @@ TEST_P(PreprocessTest, ReverseInputChannelsPreProcessSetBlob) {
auto lockedMem = inBlob->buffer();
auto *inData = lockedMem.as<float*>();
for (size_t i = 0; i < inBlob->size(); i++)
inData[i] = i;
inData[i] = static_cast<float>(i);
}
req.Infer();
@@ -500,7 +500,7 @@ TEST_P(PreprocessTest, SetScalePreProcessGetBlob) {
auto lockedMem = inBlob->buffer();
auto *inData = lockedMem.as<float*>();
for (size_t i = 0; i < inBlob->size(); i++)
inData[i] = i;
inData[i] = static_cast<float>(i);
}
req.Infer();
@@ -566,7 +566,7 @@ TEST_P(PreprocessTest, SetScalePreProcessSetBlob) {
auto lockedMem = inBlob->buffer();
auto *inData = lockedMem.as<float*>();
for (size_t i = 0; i < inBlob->size(); i++)
inData[i] = i;
inData[i] = static_cast<float>(i);
}
req.Infer();
@@ -721,11 +721,11 @@ TEST_P(PreprocessConversionTest, Infer) {
if (iPrecision == InferenceEngine::Precision::FP32) {
auto *inData = lockedMem.as<float*>();
for (size_t i = 0; i < inBlob->size(); i++)
inData[desc.offset(i)] = i;
inData[desc.offset(i)] = static_cast<float>(i);
} else if (iPrecision == InferenceEngine::Precision::U8) {
auto *inData = lockedMem.as<std::uint8_t*>();
for (size_t i = 0; i < inBlob->size(); i++)
inData[desc.offset(i)] = i;
inData[desc.offset(i)] = static_cast<std::uint8_t>(i);
} else {
ASSERT_TRUE(false);
}
@@ -30,7 +30,7 @@ TEST_P(MultipleAllocations, InferWorksCorrectAfterAllocations) {
auto ie = PluginCache::get().ie();
std::cout << "Load the network " << m_allocationsCount << " times..." << std::flush;
for (int i = 0; i < m_allocationsCount; ++i) {
for (unsigned int i = 0; i < m_allocationsCount; ++i) {
ie->LoadNetwork(cnnNet, targetDevice, configuration);
}
@@ -22,9 +22,6 @@
#include <ngraph/op/util/sub_graph_base.hpp>
#include <ngraph/opsets/opset1.hpp>
#include <ngraph/pass/visualize_tree.hpp>
#include "details/ie_exception.hpp"
namespace {
inline namespace tools {
bool isTypeRelaxed(const std::string &type) {
@@ -4,6 +4,7 @@
#pragma once
#include <limits>
#include <memory>
#include <queue>
@@ -13,6 +14,7 @@
#include <ngraph/pass/pass.hpp>
#include <ngraph/opsets/opset6.hpp>
#include "ie_common.h"
#include "test_common.hpp"
#define DYN ngraph::Dimension::dynamic()
@@ -569,7 +571,11 @@ struct Equal<uint8_t*> {
if (lhs_bit_size != rhs_bit_size) return false;
for (size_t bit_idx = 0; bit_idx < lhs_bit_size; bit_idx++) {
const uint8_t byte_idx = bit_idx / BITS_IN_BYTE_COUNT;
const auto byte_idx_result(bit_idx / BITS_IN_BYTE_COUNT);
if (byte_idx_result > std::numeric_limits<uint8_t>::max())
IE_THROW() << "(bit_idx / BITS_IN_BYTE_COUNT) bigger than uint8_t::max_value";
const uint8_t byte_idx(static_cast<uint8_t>(byte_idx_result));
const uint8_t bit_in_byte_idx = 7 - (bit_idx % BITS_IN_BYTE_COUNT);
if (extract_bit(lhs[byte_idx], bit_in_byte_idx) !=
+10 -8
View File
@@ -646,24 +646,26 @@ namespace ngraph
}
template <
ngraph::element::Type_t Type,
typename ValueT,
typename std::enable_if<Type == ngraph::element::Type_t::u4, bool>::type = true>
static ngraph::fundamental_type_for<Type>
value_in_range(const ngraph::fundamental_type_for<Type>& value)
static ngraph::fundamental_type_for<Type> value_in_range(const ValueT& value)
{
NGRAPH_CHECK(0 <= value && value <= 15,
const auto result = ngraph::fundamental_type_for<Type>(value);
NGRAPH_CHECK(0 <= result && result <= 15,
"assigned value out of range u4 values");
return value;
return result;
}
template <
ngraph::element::Type_t Type,
typename ValueT,
typename std::enable_if<Type == ngraph::element::Type_t::i4, bool>::type = true>
static ngraph::fundamental_type_for<Type>
value_in_range(const ngraph::fundamental_type_for<Type>& value)
static ngraph::fundamental_type_for<Type> value_in_range(const ValueT& value)
{
NGRAPH_CHECK(-8 <= value && value <= 7,
const auto result = ngraph::fundamental_type_for<Type>(value);
NGRAPH_CHECK(-8 <= result && result <= 7,
"assigned value out of range i4 values");
return value;
return result;
}
bool are_all_data_elements_bitwise_identical() const;