Fixed Windows warnings for core (#16523)

This commit is contained in:
Ilya Churaev 2023-03-24 13:34:06 +04:00 committed by GitHub
parent cabb917b1f
commit 077d0e43f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 15 deletions

View File

@ -31,10 +31,6 @@ set_property(SOURCE ${MIXED_SRC}
$<TARGET_PROPERTY:inference_engine_obj,SOURCE_DIR>/src
$<TARGET_PROPERTY:inference_engine_plugin_api,INTERFACE_INCLUDE_DIRECTORIES>)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
ie_add_compiler_flags(/wd4244)
endif()
# Create named folders for the sources within the .vcproj
# Empty name lists them directly under the .vcproj
@ -112,7 +108,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
endif()
target_link_options(ngraph_obj ${link_type} "/IGNORE:4217,4286")
ie_add_compiler_flags(/wd4267)
endif()
# some sources are located in ngraph, while headers are in inference_engine_transformations

View File

@ -34,7 +34,7 @@ void gather(const T* const data,
int64_t axis_size = data_shape[axis];
int64_t data_offset, out_offset, idx;
// for out of bound indices is filled with zeros
std::fill(out, out + shape_size(out_shape), 0);
std::fill(out, out + shape_size(out_shape), T{0});
for (int64_t batch = 0; batch < batch_size; batch++)
for (int64_t outer_idx = 0; outer_idx < outer_size; outer_idx++) {

View File

@ -133,10 +133,11 @@ DATA_ET bilinear(const DATA_ET* data,
const auto x_topleft = std::floor(x_d);
const auto dy = y_d - y_topleft;
const auto dx = x_d - x_topleft;
const auto v00 = get_padded(data, data_shape, n, c, y_topleft, x_topleft);
const auto v01 = get_padded(data, data_shape, n, c, y_topleft, x_topleft + 1);
const auto v10 = get_padded(data, data_shape, n, c, y_topleft + 1, x_topleft);
const auto v11 = get_padded(data, data_shape, n, c, y_topleft + 1, x_topleft + 1);
const auto v00 = get_padded(data, data_shape, n, c, static_cast<long>(y_topleft), static_cast<long>(x_topleft));
const auto v01 = get_padded(data, data_shape, n, c, static_cast<long>(y_topleft), static_cast<long>(x_topleft + 1));
const auto v10 = get_padded(data, data_shape, n, c, static_cast<long>(y_topleft + 1), static_cast<long>(x_topleft));
const auto v11 =
get_padded(data, data_shape, n, c, static_cast<long>(y_topleft + 1), static_cast<long>(x_topleft + 1));
const auto q0 = (1 - dx) * v00 + dx * v01;
const auto q1 = (1 - dx) * v10 + dx * v11;
@ -204,7 +205,13 @@ DATA_ET bicubic(const DATA_ET* data,
const auto x_topleft = std::floor(x_d);
const auto dy = y_d - y_topleft;
const auto dx = x_d - x_topleft;
const auto s = gather_4x4(data, data_shape, n, c, y_topleft - 1, x_topleft - 1, get_padded);
const auto s = gather_4x4(data,
data_shape,
n,
c,
static_cast<long>(y_topleft - 1),
static_cast<long>(x_topleft - 1),
get_padded);
const auto cy = cubic_coeffs(dy);
const auto cx = cubic_coeffs(dx);

View File

@ -59,7 +59,7 @@ std::vector<TShape> shape_infer(const SpaceToBatch* op,
auto blocks = get_input_const_data_as<TShape, int64_t>(op, 1, constant_data);
if (blocks) {
TVal block_prod = std::accumulate(begin(*blocks), end(*blocks), 1, std::multiplies<int64_t>());
TVal block_prod = std::accumulate(begin(*blocks), end(*blocks), int64_t(1), std::multiplies<int64_t>());
out_shape.push_back(data_shape[0] * block_prod);
} else {
out_shape.emplace_back(dim::inf_bound);

View File

@ -11,6 +11,15 @@ namespace ov {
namespace op {
namespace v0 {
template <class T>
struct NegativeToZero {
NegativeToZero() = default;
template <class U>
T operator()(const U u) const {
return static_cast<T>(std::max<U>(0, ov::util::InTypeRange<U>()(u)));
}
};
template <class T>
std::vector<T> shape_infer(const Tile* op,
const std::vector<T>& input_shapes,
@ -28,9 +37,7 @@ std::vector<T> shape_infer(const Tile* op,
T output_shape;
// Get repeats and pre process values
auto negative_repeats_to_zero = [](const TDimValue v) -> TDimValue {
return std::max<TDimValue>(0, ov::util::InTypeRange<TDimValue>()(v));
};
constexpr auto negative_repeats_to_zero = NegativeToZero<TDimValue>();
auto repeats = get_input_const_data_as_shape<T>(op, 1, constant_data, negative_repeats_to_zero);