From d9102350708b73f7c774100ca5c3361280c16628 Mon Sep 17 00:00:00 2001 From: Irina Efode Date: Thu, 10 Sep 2020 18:14:17 +0300 Subject: [PATCH] Fix code style (#6) --- .../core/include/ngraph/op/depth_to_space.hpp | 3 +- .../ngraph/op/embedding_segments_sum.hpp | 1 - ngraph/core/include/ngraph/op/mvn.hpp | 1 - .../include/ngraph/op/shuffle_channels.hpp | 4 +- .../core/include/ngraph/op/space_to_depth.hpp | 3 +- .../include/ngraph/runtime/reference/mvn.hpp | 58 +- .../ngraph/runtime/reference/avg_pool.hpp | 4 +- .../ngraph/runtime/reference/convolution.hpp | 173 ++-- .../ngraph/runtime/reference/quantize.hpp | 2 +- ngraph/core/src/op/batch_to_space.cpp | 70 +- ngraph/core/src/op/convert.cpp | 1 - ngraph/core/src/op/convolution.cpp | 2 +- ngraph/core/src/op/depth_to_space.cpp | 91 +- ngraph/core/src/op/group_conv.cpp | 2 +- ngraph/core/src/op/max.cpp | 3 +- ngraph/core/src/op/min.cpp | 3 +- ngraph/core/src/op/shuffle_channels.cpp | 39 +- ngraph/core/src/op/space_to_batch.cpp | 71 +- ngraph/core/src/op/space_to_depth.cpp | 76 +- ngraph/core/src/op/subtract.cpp | 75 +- ngraph/test/backend/convolution.in.cpp | 32 +- ngraph/test/backend/fused_op.in.cpp | 2 +- ngraph/test/backend/gather.in.cpp | 1 - ngraph/test/backend/zero_sized.in.cpp | 10 +- ngraph/test/onnx/onnx_import_quant.in.cpp | 3 +- ngraph/test/runtime/backend.cpp | 2 +- .../runtime/interpreter/evaluates_map.cpp | 939 +++++++++--------- .../runtime/interpreter/evaluates_map.hpp | 19 +- .../runtime/interpreter/int_executable.cpp | 75 +- .../runtime/interpreter/int_executable.hpp | 5 +- .../runtime/interpreter/opset_int_tbl.hpp | 2 +- .../runtime/interpreter/reference/elu.hpp | 2 - .../interpreter/reference/hard_sigmoid.hpp | 6 +- .../runtime/interpreter/reference/selu.hpp | 5 +- .../interpreter/reference/transpose.hpp | 19 +- ngraph/test/runtime/pass/opset0_downgrade.cpp | 1 - ngraph/test/type_prop/convolution.cpp | 299 +++--- 37 files changed, 1158 insertions(+), 946 deletions(-) diff --git a/ngraph/core/include/ngraph/op/depth_to_space.hpp b/ngraph/core/include/ngraph/op/depth_to_space.hpp index a21626ca08fc9e..cf8b4a69de2833 100644 --- a/ngraph/core/include/ngraph/op/depth_to_space.hpp +++ b/ngraph/core/include/ngraph/op/depth_to_space.hpp @@ -73,7 +73,8 @@ namespace ngraph virtual std::shared_ptr clone_with_new_inputs(const OutputVector& new_args) const override; - bool evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const override; + bool evaluate(const HostTensorVector& outputs, + const HostTensorVector& inputs) const override; protected: std::size_t m_blocksize; diff --git a/ngraph/core/include/ngraph/op/embedding_segments_sum.hpp b/ngraph/core/include/ngraph/op/embedding_segments_sum.hpp index ff3b6263c18a81..24827c5571df87 100644 --- a/ngraph/core/include/ngraph/op/embedding_segments_sum.hpp +++ b/ngraph/core/include/ngraph/op/embedding_segments_sum.hpp @@ -79,7 +79,6 @@ namespace ngraph clone_with_new_inputs(const OutputVector& new_args) const override; virtual bool visit_attributes(AttributeVisitor& visitor) override { return true; } - private: static constexpr int EMB_TABLE = 0; static constexpr int INDICES = 1; diff --git a/ngraph/core/include/ngraph/op/mvn.hpp b/ngraph/core/include/ngraph/op/mvn.hpp index 3b745e4114786a..6b4810968adf3d 100644 --- a/ngraph/core/include/ngraph/op/mvn.hpp +++ b/ngraph/core/include/ngraph/op/mvn.hpp @@ -79,7 +79,6 @@ namespace ngraph bool get_normalize_variance() const { return m_normalize_variance; } AxisSet get_reduction_axes() const { return m_reduction_axes; } void set_reduction_axes(AxisSet axes) { m_reduction_axes = axes; } - private: double m_eps = 1e-9; bool m_across_channels; diff --git a/ngraph/core/include/ngraph/op/shuffle_channels.hpp b/ngraph/core/include/ngraph/op/shuffle_channels.hpp index 78a9d5d0bfc689..667a226c41e69e 100644 --- a/ngraph/core/include/ngraph/op/shuffle_channels.hpp +++ b/ngraph/core/include/ngraph/op/shuffle_channels.hpp @@ -62,7 +62,9 @@ namespace ngraph int64_t get_axis() const { return m_axis; } int64_t get_group() const { return m_group; } - bool evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const override; + bool evaluate(const HostTensorVector& outputs, + const HostTensorVector& inputs) const override; + private: /// \brief Generates a shape required to permute the data /// diff --git a/ngraph/core/include/ngraph/op/space_to_depth.hpp b/ngraph/core/include/ngraph/op/space_to_depth.hpp index 057001c7fe1858..c995de05adc247 100644 --- a/ngraph/core/include/ngraph/op/space_to_depth.hpp +++ b/ngraph/core/include/ngraph/op/space_to_depth.hpp @@ -71,7 +71,8 @@ namespace ngraph virtual std::shared_ptr clone_with_new_inputs(const OutputVector& new_args) const override; - bool evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const override; + bool evaluate(const HostTensorVector& outputs, + const HostTensorVector& inputs) const override; protected: std::size_t m_blocksize; diff --git a/ngraph/core/include/ngraph/runtime/reference/mvn.hpp b/ngraph/core/include/ngraph/runtime/reference/mvn.hpp index 947611d39c03ee..41d43e43c91e8c 100644 --- a/ngraph/core/include/ngraph/runtime/reference/mvn.hpp +++ b/ngraph/core/include/ngraph/runtime/reference/mvn.hpp @@ -17,44 +17,62 @@ #pragma once #include -#include -#include #include -#include +#include #include -#include #include +#include +#include +#include -namespace ngraph { - namespace runtime { - namespace reference { - template - void mvn(const T *arg, T *out, const Shape &in_shape, bool normalize_variance, AxisSet reduction_axes, - double eps) { +namespace ngraph +{ + namespace runtime + { + namespace reference + { + template + void mvn(const T* arg, + T* out, + const Shape& in_shape, + bool normalize_variance, + AxisSet reduction_axes, + double eps) + { auto reduced_shape = reduce(in_shape, reduction_axes, true); std::vector mean_val(shape_size(reduced_shape)); mean(arg, mean_val.data(), in_shape, reduction_axes, true); std::vector broadcast_mean_data(shape_size(in_shape)); - broadcast(mean_val.data(), broadcast_mean_data.data(), reduced_shape, in_shape, reduction_axes); + broadcast(mean_val.data(), + broadcast_mean_data.data(), + reduced_shape, + in_shape, + reduction_axes); subtract(arg, broadcast_mean_data.data(), out, shape_size(in_shape)); - if (normalize_variance) { + if (normalize_variance) + { std::vector multiply_val(shape_size(in_shape)); - multiply(out, out, multiply_val.data(),shape_size(in_shape)); + multiply(out, out, multiply_val.data(), shape_size(in_shape)); std::vector sum_val(shape_size(reduced_shape)); sum(multiply_val.data(), sum_val.data(), in_shape, reduction_axes, true); std::vector broadcast_sum(shape_size(in_shape)); - broadcast(sum_val.data(), broadcast_sum.data(), reduced_shape, in_shape, reduction_axes); + broadcast(sum_val.data(), + broadcast_sum.data(), + reduced_shape, + in_shape, + reduction_axes); T n = 1; - for (auto i : reduction_axes) { + for (auto i : reduction_axes) + { n *= in_shape[i]; } - for (size_t i = 0; i < shape_size(in_shape); ++i) { + for (size_t i = 0; i < shape_size(in_shape); ++i) + { out[i] /= std::sqrt(broadcast_sum[i] / n) + eps; } - } } - } // namespace reference - } // namespace runtime -} // namespace ngraph + } // namespace reference + } // namespace runtime +} // namespace ngraph diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/avg_pool.hpp b/ngraph/core/reference/include/ngraph/runtime/reference/avg_pool.hpp index 1f7b50651ff842..5a0e05851d7a10 100644 --- a/ngraph/core/reference/include/ngraph/runtime/reference/avg_pool.hpp +++ b/ngraph/core/reference/include/ngraph/runtime/reference/avg_pool.hpp @@ -223,8 +223,8 @@ namespace ngraph if (in_bounds || include_padding_in_avg_computation) { - T v = - in_bounds ? arg[input_batch_transform.index(input_batch_coord)] : static_cast(0); + T v = in_bounds ? arg[input_batch_transform.index(input_batch_coord)] + : static_cast(0); result += v; n_elements++; } diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/convolution.hpp b/ngraph/core/reference/include/ngraph/runtime/reference/convolution.hpp index 5299f6d99b814e..492ac393c751e2 100644 --- a/ngraph/core/reference/include/ngraph/runtime/reference/convolution.hpp +++ b/ngraph/core/reference/include/ngraph/runtime/reference/convolution.hpp @@ -23,8 +23,8 @@ #include "ngraph/axis_vector.hpp" #include "ngraph/coordinate_transform.hpp" -#include "ngraph/runtime/reference/reverse.hpp" #include "ngraph/runtime/reference/concat.hpp" +#include "ngraph/runtime/reference/reverse.hpp" #include "ngraph/util.hpp" namespace ngraph @@ -98,19 +98,22 @@ namespace ngraph size_t filter_groups_stride = 0; size_t channels_in_group = in_shape[in_channel_axis]; std::vector> result_groups(num_groups); - if (num_groups > 1) { + if (num_groups > 1) + { NGRAPH_CHECK(in_shape[in_channel_axis] % num_groups == 0, - "Number of input channels and number of groups must be multiplies of each other"); + "Number of input channels and number of groups must be multiplies " + "of each other"); channels_in_group = in_shape[in_channel_axis] / num_groups; group_out_shape[out_channel_axis] = filter_shape.at(filter_out_channel_axis); group_in_shape[in_channel_axis] = channels_in_group; - filter_group_shape = Shape(std::vector(filter_shape.begin() + 1, filter_shape.end())); - filter_groups_stride = std::accumulate(filter_shape.begin() + 1, filter_shape.end(), 1, - std::multiplies()); - // Further we will operate with filter_group_shape which doesn't have groups dimension + filter_group_shape = + Shape(std::vector(filter_shape.begin() + 1, filter_shape.end())); + filter_groups_stride = std::accumulate( + filter_shape.begin() + 1, filter_shape.end(), 1, std::multiplies()); + // Further we will operate with filter_group_shape which doesn't have groups + // dimension filter_out_channel_axis -= 1; filter_in_channel_axis -= 1; - } std::fesetround(FE_TONEAREST); @@ -123,13 +126,15 @@ namespace ngraph // At the outermost level we will walk over every out coordinate O. CoordinateTransform out_transform(group_out_shape); - for (size_t g = 0; g < num_groups; g++) { - const FILTER *filter_group_data = filter + filter_groups_stride * g; + for (size_t g = 0; g < num_groups; g++) + { + const FILTER* filter_group_data = filter + filter_groups_stride * g; result_groups[g].resize(shape_size(group_out_shape)); const size_t ch_start = channels_in_group * g; const size_t ch_end = channels_in_group * (g + 1); - for (const Coordinate &out_coord : out_transform) { + for (const Coordinate& out_coord : out_transform) + { // Our out coordinate O will have the form: // // (N,chan_out,i_1,...,i_n) @@ -156,7 +161,8 @@ namespace ngraph // (1,l_1,...,l_n). // // Note that we are iterating within the *padded* and *dilated* in batch, so - // further down we must check the current coordinate is in the pad or dilation + // further down we must check the current coordinate is in the pad or + // dilation // gap. size_t n_spatial_dimensions = group_in_shape.size() - 2; @@ -174,7 +180,8 @@ namespace ngraph in_transform_start[in_channel_axis] = 0; in_transform_end[in_channel_axis] = 1; - for (size_t i = 2; i < n_spatial_dimensions + 2; i++) { + for (size_t i = 2; i < n_spatial_dimensions + 2; i++) + { size_t filter_dilation_stride = filter_dilation[i - 2]; size_t filter_movement_stride = stride[i - 2]; std::ptrdiff_t below_pad = in_pad_below[i - 2]; @@ -182,8 +189,9 @@ namespace ngraph size_t in_dilation_stride = in_dilation[i - 2]; in_transform_start[i] = filter_movement_stride * out_coord[i]; - in_transform_end[i] = in_transform_start[i] + - (filter_group_shape[i] - 1) * filter_dilation_stride + 1; + in_transform_end[i] = + in_transform_start[i] + + (filter_group_shape[i] - 1) * filter_dilation_stride + 1; in_transform_movement_strides[i] = filter_dilation_stride; in_transform_pad_below[i] = below_pad; in_transform_pad_above[i] = above_pad; @@ -191,7 +199,8 @@ namespace ngraph } AxisVector in_transform_axis_order(2 + n_spatial_dimensions); - for (size_t i = 0; i < in_transform_axis_order.size(); i++) { + for (size_t i = 0; i < in_transform_axis_order.size(); i++) + { in_transform_axis_order[i] = i; } CoordinateTransform in_transform(group_in_shape, @@ -227,13 +236,14 @@ namespace ngraph filter_transform_start[filter_in_channel_axis] = 0; filter_transform_end[filter_in_channel_axis] = 1; - for (size_t i = 2; i < n_spatial_dimensions + 2; i++) { + for (size_t i = 2; i < n_spatial_dimensions + 2; i++) + { filter_transform_start[i] = 0; filter_transform_end[i] = filter_group_shape[i]; } CoordinateTransform filter_transform( - filter_group_shape, filter_transform_start, filter_transform_end); + filter_group_shape, filter_transform_start, filter_transform_end); // As we go, we sum up: // @@ -246,20 +256,27 @@ namespace ngraph CoordinateTransform::Iterator in_it_end = in_transform.end(); CoordinateTransform::Iterator filter_it_end = filter_transform.end(); - size_t in_channel_stride = row_major_strides(group_in_shape).at(in_channel_axis); + size_t in_channel_stride = + row_major_strides(group_in_shape).at(in_channel_axis); size_t filter_in_channel_stride = - row_major_strides(filter_group_shape).at(filter_in_channel_axis); + row_major_strides(filter_group_shape).at(filter_in_channel_axis); size_t group_channel_offset = in_channel_stride * channels_in_group * g; - while (in_it != in_it_end && filter_it != filter_it_end) { - const Coordinate &in_coord = *in_it; - if (in_transform.has_source_coordinate(in_coord)) { + while (in_it != in_it_end && filter_it != filter_it_end) + { + const Coordinate& in_coord = *in_it; + if (in_transform.has_source_coordinate(in_coord)) + { size_t in_idx = in_transform.index(in_coord) + group_channel_offset; - const Coordinate &filter_coord = *filter_it; + const Coordinate& filter_coord = *filter_it; size_t filter_idx = filter_transform.index(filter_coord); - for (size_t in_channel = ch_start; in_channel < ch_end; ++in_channel) { + for (size_t in_channel = ch_start; in_channel < ch_end; + ++in_channel) + { ACCUMULATION in_v = static_cast(in[in_idx]); - ACCUMULATION f_v = static_cast(filter_group_data[filter_idx]); - if (is_quantized) { + ACCUMULATION f_v = + static_cast(filter_group_data[filter_idx]); + if (is_quantized) + { in_v = in_v - static_cast(*input_zero_point); f_v = f_v - static_cast(*filter_zero_point); } @@ -271,26 +288,42 @@ namespace ngraph ++in_it; ++filter_it; } - if (is_quantized) { + if (is_quantized) + { float scale = *input_scale * *filter_scale / *output_scale; result_groups[g][out_transform.index(out_coord)] = - static_cast(std::round(static_cast(result) * scale)) + - *output_zero_point; - } else { + static_cast( + std::round(static_cast(result) * scale)) + + *output_zero_point; + } + else + { result_groups[g][out_transform.index(out_coord)] = result; } } } - if (num_groups > 1){ + if (num_groups > 1) + { std::vector const_results_cpy; std::vector in_shapes; - for (size_t g = 0; g < num_groups; g++){ - const_results_cpy.push_back(reinterpret_cast(result_groups[g].data())); + for (size_t g = 0; g < num_groups; g++) + { + const_results_cpy.push_back( + reinterpret_cast(result_groups[g].data())); in_shapes.push_back(group_out_shape); } - concat(const_results_cpy, reinterpret_cast(out), in_shapes, Shape(out_shape), in_channel_axis, sizeof(OUTPUT)); - } else { - std::copy(result_groups[0].data(), result_groups[0].data() + shape_size(out_shape), out); + concat(const_results_cpy, + reinterpret_cast(out), + in_shapes, + Shape(out_shape), + in_channel_axis, + sizeof(OUTPUT)); + } + else + { + std::copy(result_groups[0].data(), + result_groups[0].data() + shape_size(out_shape), + out); } std::fesetround(old_mode); @@ -370,7 +403,8 @@ namespace ngraph std::vector reversed(shape_size(filter_shape)); AxisSet reverse_axes; size_t reverse_axes_start = num_groups == 1 ? 2 : 3; - for (size_t i = reverse_axes_start; i < filter_shape.size(); ++i) { + for (size_t i = reverse_axes_start; i < filter_shape.size(); ++i) + { reverse_axes.insert(i); } reverse(reinterpret_cast(filter), @@ -383,50 +417,53 @@ namespace ngraph size_t filter_in_channel_axis = num_groups == 1 ? 0 : 1; // Compute backward pad out pad bellow - size_t spatial_dim_count = num_groups == 1 ? static_cast(in_shape.size()) - 2 : - static_cast(in_shape.size()) - 3; + size_t spatial_dim_count = num_groups == 1 + ? static_cast(in_shape.size()) - 2 + : static_cast(in_shape.size()) - 3; CoordinateDiff backward_delta_out_pad_below; backward_delta_out_pad_below.resize(spatial_dim_count); - for (size_t i = 0; i < spatial_dim_count; i++) { + for (size_t i = 0; i < spatial_dim_count; i++) + { backward_delta_out_pad_below[i] = - (static_cast(filter_shape[i + 2]) - 1) * filter_dilation[i] - - forward_in_pad_bellow[i]; + (static_cast(filter_shape[i + 2]) - 1) * filter_dilation[i] - + forward_in_pad_bellow[i]; } // Compute backward pad out pad above CoordinateDiff backward_delta_out_pad_above; backward_delta_out_pad_above.resize(spatial_dim_count); - for (size_t i = 0; i < spatial_dim_count; i++) { + for (size_t i = 0; i < spatial_dim_count; i++) + { backward_delta_out_pad_above[i] = - (static_cast(filter_shape[i + 2]) - 1) * filter_dilation[i] + - ((forward_in_pad_bellow[i] + ((in_shape[i + 2]) - 1) * in_dilation[i] + - forward_in_pad_above[i] - - (static_cast(filter_shape[i + 2]) - 1) * filter_dilation[i]) % - stride[i]) - - forward_in_pad_above[i]; + (static_cast(filter_shape[i + 2]) - 1) * filter_dilation[i] + + ((forward_in_pad_bellow[i] + ((in_shape[i + 2]) - 1) * in_dilation[i] + + forward_in_pad_above[i] - + (static_cast(filter_shape[i + 2]) - 1) * filter_dilation[i]) % + stride[i]) - + forward_in_pad_above[i]; } general_convolution( - delta_out, - &reversed[0], - delta_in, - out_shape, - filter_shape, - in_shape, - in_dilation, - filter_dilation, - backward_delta_out_pad_below, - backward_delta_out_pad_above, - stride, - num_groups, - 0, - 1, - filter_out_channel_axis, - filter_in_channel_axis, - 0, - 1); + delta_out, + &reversed[0], + delta_in, + out_shape, + filter_shape, + in_shape, + in_dilation, + filter_dilation, + backward_delta_out_pad_below, + backward_delta_out_pad_above, + stride, + num_groups, + 0, + 1, + filter_out_channel_axis, + filter_in_channel_axis, + 0, + 1); } } // namespace reference } // namespace runtime diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/quantize.hpp b/ngraph/core/reference/include/ngraph/runtime/reference/quantize.hpp index cf8595ac9f5d84..6d9e3b28ab6838 100644 --- a/ngraph/core/reference/include/ngraph/runtime/reference/quantize.hpp +++ b/ngraph/core/reference/include/ngraph/runtime/reference/quantize.hpp @@ -56,7 +56,7 @@ namespace ngraph REAL abs_qvalue_toward_inf = std::floor(abs_qvalue + static_cast(0.5)); qvalue = (qvalue < REAL(0.0)) ? REAL(-abs_qvalue_toward_inf) - : REAL(abs_qvalue_toward_inf); + : REAL(abs_qvalue_toward_inf); } else if (round_mode == op::Quantize::RoundMode::ROUND_NEAREST_TOWARD_ZERO) { diff --git a/ngraph/core/src/op/batch_to_space.cpp b/ngraph/core/src/op/batch_to_space.cpp index 445aaa6f464ac3..142ec4628af6ad 100644 --- a/ngraph/core/src/op/batch_to_space.cpp +++ b/ngraph/core/src/op/batch_to_space.cpp @@ -22,14 +22,13 @@ #include "ngraph/builder/make_constant.hpp" #include "ngraph/node.hpp" #include "ngraph/op/batch_to_space.hpp" -#include "ngraph/shape.hpp" #include "ngraph/opsets/opset3.hpp" +#include "ngraph/shape.hpp" #include "ngraph/runtime/opt_kernel/reshape.hpp" #include "ngraph/runtime/reference/strided_slice.hpp" #include "ngraph/slice_plan.hpp" - using namespace std; using namespace ngraph; @@ -142,24 +141,26 @@ bool ngraph::op::v1::BatchToSpace::visit_attributes(ngraph::AttributeVisitor& vi return true; } -bool ngraph::op::v1::BatchToSpace::evaluate(const HostTensorVector &outputs, - const HostTensorVector &inputs) const { +bool ngraph::op::v1::BatchToSpace::evaluate(const HostTensorVector& outputs, + const HostTensorVector& inputs) const +{ auto data = inputs[0]; size_t elem_size = data->get_element_type().size(); - if (data->get_partial_shape().is_dynamic()) { + if (data->get_partial_shape().is_dynamic()) + { return false; } auto data_shape = data->get_shape(); - if (!(data->get_shape().size() == 4 || data->get_shape().size() == 5)) { + if (!(data->get_shape().size() == 4 || data->get_shape().size() == 5)) + { return false; } size_t block_values_size = shape_size(inputs[1]->get_shape()); - const auto *block_values = inputs[1]->get_data_ptr(); - const auto *crops_begin_values = inputs[2]->get_data_ptr(); - const auto *crops_end_values = inputs[3]->get_data_ptr(); - + const auto* block_values = inputs[1]->get_data_ptr(); + const auto* crops_begin_values = inputs[2]->get_data_ptr(); + const auto* crops_end_values = inputs[3]->get_data_ptr(); Shape dispersed_shape(1); dispersed_shape.insert(dispersed_shape.end(), data_shape.begin(), data_shape.end()); @@ -167,47 +168,67 @@ bool ngraph::op::v1::BatchToSpace::evaluate(const HostTensorVector &outputs, std::vector plain_axes_order(block_values_size + 1); std::iota(plain_axes_order.begin(), plain_axes_order.end(), 0); Shape squeezed_shape(data_shape.begin(), data_shape.end()); - if (squeezed_shape.size() > block_values_size) { + if (squeezed_shape.size() > block_values_size) + { return false; } - auto *flat_data = data->get_data_ptr(); + auto* flat_data = data->get_data_ptr(); std::vector dispersed_data(shape_size(data_shape) * elem_size); Shape post_transpose_shape(axes_order.size()); std::vector post_transpose_data(shape_size(data_shape) * elem_size); - for (size_t block_idx = 1; block_idx < block_values_size; ++block_idx) { + for (size_t block_idx = 1; block_idx < block_values_size; ++block_idx) + { dispersed_shape[0] = block_values[block_idx]; dispersed_shape[1] /= block_values[block_idx]; - runtime::opt_kernel::reshape(flat_data, dispersed_data.data(), data_shape, plain_axes_order, dispersed_shape, + runtime::opt_kernel::reshape(flat_data, + dispersed_data.data(), + data_shape, + plain_axes_order, + dispersed_shape, elem_size); size_t val = 1; - for (size_t axis_idx = 0; axis_idx <= block_values_size; ++axis_idx) { - if ((block_idx + 1) == axis_idx) { + for (size_t axis_idx = 0; axis_idx <= block_values_size; ++axis_idx) + { + if ((block_idx + 1) == axis_idx) + { axes_order[axis_idx] = 0; - } else { + } + else + { axes_order[axis_idx] = val; val++; } } - for (size_t axis_idx = 0; axis_idx < axes_order.size(); ++axis_idx) { + for (size_t axis_idx = 0; axis_idx < axes_order.size(); ++axis_idx) + { post_transpose_shape[axis_idx] = dispersed_shape[axes_order[axis_idx]]; } - runtime::opt_kernel::reshape(dispersed_data.data(), post_transpose_data.data(), dispersed_shape, axes_order, - post_transpose_shape, elem_size); + runtime::opt_kernel::reshape(dispersed_data.data(), + post_transpose_data.data(), + dispersed_shape, + axes_order, + post_transpose_shape, + elem_size); squeezed_shape[0] = dispersed_shape[1]; squeezed_shape[block_idx] *= block_values[block_idx]; dispersed_shape[block_idx + 1] = squeezed_shape[block_idx]; - runtime::opt_kernel::reshape(post_transpose_data.data(), flat_data, post_transpose_shape, plain_axes_order, - squeezed_shape, elem_size); + runtime::opt_kernel::reshape(post_transpose_data.data(), + flat_data, + post_transpose_shape, + plain_axes_order, + squeezed_shape, + elem_size); data_shape = squeezed_shape; } std::vector upperbounds_values(data_shape.size()); - for (size_t i = 0; i < data_shape.size(); ++i) { + for (size_t i = 0; i < data_shape.size(); ++i) + { upperbounds_values[i] = data_shape[i] - crops_end_values[i]; } @@ -227,6 +248,7 @@ bool ngraph::op::v1::BatchToSpace::evaluate(const HostTensorVector &outputs, AxisSet(), AxisSet(), AxisSet()); - runtime::reference::strided_slice(flat_data, outputs[0]->get_data_ptr(), data_shape, slice_plan, elem_size); + runtime::reference::strided_slice( + flat_data, outputs[0]->get_data_ptr(), data_shape, slice_plan, elem_size); return true; } \ No newline at end of file diff --git a/ngraph/core/src/op/convert.cpp b/ngraph/core/src/op/convert.cpp index a761ef25d64edf..9b5a9bf4434c31 100644 --- a/ngraph/core/src/op/convert.cpp +++ b/ngraph/core/src/op/convert.cpp @@ -63,7 +63,6 @@ namespace true); } - #define TYPE_OUT_CASE(a) \ case element::Type_t::a: rc = evaluate diff --git a/ngraph/core/src/op/convolution.cpp b/ngraph/core/src/op/convolution.cpp index c9f470de7f3088..f1a53f67b4249a 100644 --- a/ngraph/core/src/op/convolution.cpp +++ b/ngraph/core/src/op/convolution.cpp @@ -18,9 +18,9 @@ #include "ngraph/axis_vector.hpp" #include "ngraph/coordinate_diff.hpp" #include "ngraph/op/reshape.hpp" +#include "ngraph/runtime/reference/convolution.hpp" #include "ngraph/util.hpp" #include "ngraph/validation_util.hpp" -#include "ngraph/runtime/reference/convolution.hpp" using namespace std; using namespace ngraph; diff --git a/ngraph/core/src/op/depth_to_space.cpp b/ngraph/core/src/op/depth_to_space.cpp index 8b75fbce2ba58f..abe2cb6e4feead 100644 --- a/ngraph/core/src/op/depth_to_space.cpp +++ b/ngraph/core/src/op/depth_to_space.cpp @@ -165,13 +165,16 @@ shared_ptr op::DepthToSpace::clone_with_new_inputs(const OutputVector& new return make_shared(new_args.at(0), m_mode, m_blocksize); } -bool op::DepthToSpace::evaluate(const HostTensorVector &outputs, const HostTensorVector &inputs) const { - const auto &data = inputs[0]; - const auto &out = outputs[0]; - const auto &out_shape = out->get_shape(); +bool op::DepthToSpace::evaluate(const HostTensorVector& outputs, + const HostTensorVector& inputs) const +{ + const auto& data = inputs[0]; + const auto& out = outputs[0]; + const auto& out_shape = out->get_shape(); size_t elem_size = data->get_element_type().size(); - if (data->get_partial_shape().is_dynamic()) { + if (data->get_partial_shape().is_dynamic()) + { return false; } auto data_shape = data->get_shape(); @@ -197,44 +200,51 @@ bool op::DepthToSpace::evaluate(const HostTensorVector &outputs, const HostTenso // Finally squeeze data from respective dimensions. shared_ptr flat_node; Shape dispersed_shape{n_dim}; - for (int i = 0; i < spatial_dims; ++i) { + for (int i = 0; i < spatial_dims; ++i) + { dispersed_shape.push_back(bs); } - for (int i = 0; i < spatial_dims; ++i) { + for (int i = 0; i < spatial_dims; ++i) + { dispersed_shape.push_back(data_shape.at(spatial_dim_index + i)); } vector axes_order{0}; - switch (m_mode) { - // x' = reshape(data, [N, C / (block_size ^ K), block_size, block_size, ..., block_size, D1, D2, - // ..., DK]) - // x'' = transpose(x', [0, 1, K + 2, 2, K + 3, 3, K + 4, 4, ..., K + (K + 1), K + 1]) - // y = reshape(x'', [N, C / (block_size ^ K), D1 * block_size, D2 * block_size, D3 * block_size, - // ..., DK * block_size]) - case DepthToSpaceMode::DEPTH_FIRST: { - dispersed_shape.insert(dispersed_shape.begin() + 1, c_flat); - axes_order.push_back(1); - for (int i = spatial_dim_index; i < data_shape.size(); ++i) { - axes_order.push_back(spatial_dims + i); - axes_order.push_back(i); - } - - break; + switch (m_mode) + { + // x' = reshape(data, [N, C / (block_size ^ K), block_size, block_size, ..., block_size, D1, D2, + // ..., DK]) + // x'' = transpose(x', [0, 1, K + 2, 2, K + 3, 3, K + 4, 4, ..., K + (K + 1), K + 1]) + // y = reshape(x'', [N, C / (block_size ^ K), D1 * block_size, D2 * block_size, D3 * block_size, + // ..., DK * block_size]) + case DepthToSpaceMode::DEPTH_FIRST: + { + dispersed_shape.insert(dispersed_shape.begin() + 1, c_flat); + axes_order.push_back(1); + for (int i = spatial_dim_index; i < data_shape.size(); ++i) + { + axes_order.push_back(spatial_dims + i); + axes_order.push_back(i); } - // x' = reshape(data, [N, block_size, block_size, ..., block_size, C / (block_size ^ K), D1, D2, - // ..., DK]) - // x'' = transpose(x', [0, K + 1, K + 2, 1, K + 3, 2, K + 4, 3, ..., K + (K + 1), K]) - // y = reshape(x'', [N, C / (block_size ^ K), D1 * block_size, D2 * block_size, D3 * block_size, - // ..., DK * block_size]) - case DepthToSpaceMode::BLOCKS_FIRST: - default: { - dispersed_shape.insert(dispersed_shape.begin() + spatial_dims + 1, c_flat); - axes_order.push_back(spatial_dims + 1); - for (int i = 2; i < data_shape.size(); ++i) { - axes_order.push_back(spatial_dims + i); - axes_order.push_back(i - 1); - } - break; + + break; + } + // x' = reshape(data, [N, block_size, block_size, ..., block_size, C / (block_size ^ K), D1, D2, + // ..., DK]) + // x'' = transpose(x', [0, K + 1, K + 2, 1, K + 3, 2, K + 4, 3, ..., K + (K + 1), K]) + // y = reshape(x'', [N, C / (block_size ^ K), D1 * block_size, D2 * block_size, D3 * block_size, + // ..., DK * block_size]) + case DepthToSpaceMode::BLOCKS_FIRST: + default: + { + dispersed_shape.insert(dispersed_shape.begin() + spatial_dims + 1, c_flat); + axes_order.push_back(spatial_dims + 1); + for (int i = 2; i < data_shape.size(); ++i) + { + axes_order.push_back(spatial_dims + i); + axes_order.push_back(i - 1); } + break; + } } std::vector plain_axes_order(data_shape.size()); std::iota(plain_axes_order.begin(), plain_axes_order.end(), 0); @@ -249,7 +259,8 @@ bool op::DepthToSpace::evaluate(const HostTensorVector &outputs, const HostTenso elem_size); Shape post_transpose_shape(axes_order.size()); - for (size_t axis_idx = 0; axis_idx < axes_order.size(); ++axis_idx) { + for (size_t axis_idx = 0; axis_idx < axes_order.size(); ++axis_idx) + { post_transpose_shape[axis_idx] = dispersed_shape[axes_order[axis_idx]]; } runtime::opt_kernel::reshape(dispersed_data.data(), @@ -260,10 +271,12 @@ bool op::DepthToSpace::evaluate(const HostTensorVector &outputs, const HostTenso elem_size); Shape squeezed_shape{n_dim, c_flat}; - for (int i = spatial_dim_index; i < data_shape.size(); ++i) { + for (int i = spatial_dim_index; i < data_shape.size(); ++i) + { squeezed_shape.push_back(data_shape.at(i) * bs); } - for (size_t i = plain_axes_order.size() - 1; i < post_transpose_shape.size() - 1; ++i) { + for (size_t i = plain_axes_order.size() - 1; i < post_transpose_shape.size() - 1; ++i) + { plain_axes_order.push_back(plain_axes_order[i] + 1); } runtime::opt_kernel::reshape(transposed_data.data(), diff --git a/ngraph/core/src/op/group_conv.cpp b/ngraph/core/src/op/group_conv.cpp index aaaa4252268da7..9b03d00fd6323e 100644 --- a/ngraph/core/src/op/group_conv.cpp +++ b/ngraph/core/src/op/group_conv.cpp @@ -24,8 +24,8 @@ #include "ngraph/op/group_conv.hpp" #include "ngraph/op/reshape.hpp" #include "ngraph/op/slice.hpp" -#include "ngraph/validation_util.hpp" #include "ngraph/runtime/reference/convolution.hpp" +#include "ngraph/validation_util.hpp" using namespace std; using namespace ngraph; diff --git a/ngraph/core/src/op/max.cpp b/ngraph/core/src/op/max.cpp index b92c532ad03710..8b12bb018fc846 100644 --- a/ngraph/core/src/op/max.cpp +++ b/ngraph/core/src/op/max.cpp @@ -96,7 +96,8 @@ namespace const AxisSet& axes, bool keep_dims) { - runtime::reference::max(arg->get_data_ptr(), out->get_data_ptr(), arg->get_shape(), axes, keep_dims); + runtime::reference::max( + arg->get_data_ptr(), out->get_data_ptr(), arg->get_shape(), axes, keep_dims); return true; } diff --git a/ngraph/core/src/op/min.cpp b/ngraph/core/src/op/min.cpp index bc3498da083bcc..3b1fd8772e23a8 100644 --- a/ngraph/core/src/op/min.cpp +++ b/ngraph/core/src/op/min.cpp @@ -93,7 +93,8 @@ namespace template bool evaluate(const HostTensorPtr& arg, const HostTensorPtr& out, const AxisSet& axes) { - runtime::reference::min(arg->get_data_ptr(), out->get_data_ptr(), arg->get_shape(), axes); + runtime::reference::min( + arg->get_data_ptr(), out->get_data_ptr(), arg->get_shape(), axes); return true; } diff --git a/ngraph/core/src/op/shuffle_channels.cpp b/ngraph/core/src/op/shuffle_channels.cpp index 97566744e97f7a..0ae0b2a4352a41 100644 --- a/ngraph/core/src/op/shuffle_channels.cpp +++ b/ngraph/core/src/op/shuffle_channels.cpp @@ -15,13 +15,13 @@ //***************************************************************************** #include -#include "ngraph/op/shuffle_channels.hpp" #include "ngraph/attribute_visitor.hpp" +#include "ngraph/builder/reshape.hpp" +#include "ngraph/op/shuffle_channels.hpp" #include "ngraph/runtime/host_tensor.hpp" +#include "ngraph/runtime/opt_kernel/reshape.hpp" #include "ngraph/type/element_type.hpp" #include "ngraph/type/element_type_traits.hpp" -#include "ngraph/builder/reshape.hpp" -#include "ngraph/runtime/opt_kernel/reshape.hpp" using namespace std; using namespace ngraph; @@ -143,44 +143,53 @@ Shape op::ShuffleChannels::get_pre_shuffle_shape(const Shape& data_shape) const return res; } -bool op::ShuffleChannels::evaluate(const HostTensorVector &outputs, const HostTensorVector &inputs) const { +bool op::ShuffleChannels::evaluate(const HostTensorVector& outputs, + const HostTensorVector& inputs) const +{ const auto arg = inputs[0]->get_data_ptr(); auto out = outputs[0]->get_data_ptr(); Shape data_shape = inputs[0]->get_shape(); - const Shape &ds = data_shape; + const Shape& ds = data_shape; size_t elem_size = inputs[0]->get_element_type().size(); Shape pre_reshape_shape(4, 1); size_t axis_zb = m_axis >= 0 ? m_axis : m_axis + data_shape.size(); - for (size_t i = 0; i < axis_zb; ++i) { + for (size_t i = 0; i < axis_zb; ++i) + { pre_reshape_shape[0] *= ds[i]; } pre_reshape_shape[1] = m_group; pre_reshape_shape[2] = ds[axis_zb] / m_group; - for (size_t i = axis_zb + 1; i < ds.size(); ++i) { + for (size_t i = axis_zb + 1; i < ds.size(); ++i) + { pre_reshape_shape[3] *= ds[i]; } AxisVector axes_order(data_shape.size()); std::iota(axes_order.begin(), axes_order.end(), 0); size_t data_size = shape_size(data_shape) * elem_size; std::vector reshaped(data_size); - runtime::opt_kernel::reshape(arg, reshaped.data(), data_shape, axes_order, - pre_reshape_shape, elem_size); + runtime::opt_kernel::reshape( + arg, reshaped.data(), data_shape, axes_order, pre_reshape_shape, elem_size); Shape transpose_axes_order = {0, 2, 1, 3}; Shape transposed_shape = pre_reshape_shape; - for (size_t i = 0; i < transpose_axes_order.size(); ++i) { + for (size_t i = 0; i < transpose_axes_order.size(); ++i) + { transposed_shape[i] = data_shape.at(transpose_axes_order.at(i)); } auto axis_vector = AxisVector{begin(transpose_axes_order), end(transpose_axes_order)}; std::vector transposed(data_size); - runtime::opt_kernel::reshape(reshaped.data(), transposed.data(), pre_reshape_shape, axis_vector, - transposed_shape, elem_size); - - runtime::opt_kernel::reshape(transposed.data(), out, transposed_shape, axes_order, - data_shape, elem_size); + runtime::opt_kernel::reshape(reshaped.data(), + transposed.data(), + pre_reshape_shape, + axis_vector, + transposed_shape, + elem_size); + + runtime::opt_kernel::reshape( + transposed.data(), out, transposed_shape, axes_order, data_shape, elem_size); return true; } diff --git a/ngraph/core/src/op/space_to_batch.cpp b/ngraph/core/src/op/space_to_batch.cpp index a66b62b0bb7e63..c5aa1c583ac754 100644 --- a/ngraph/core/src/op/space_to_batch.cpp +++ b/ngraph/core/src/op/space_to_batch.cpp @@ -24,8 +24,8 @@ #include "ngraph/ops.hpp" #include "ngraph/shape.hpp" -#include "ngraph/runtime/reference/pad.hpp" #include "ngraph/runtime/opt_kernel/reshape.hpp" +#include "ngraph/runtime/reference/pad.hpp" using namespace std; using namespace ngraph; @@ -140,25 +140,29 @@ bool ngraph::op::v1::SpaceToBatch::visit_attributes(ngraph::AttributeVisitor& vi return true; } -bool ngraph::op::v1::SpaceToBatch::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const { - const auto &data = inputs[0]; - const auto &out = outputs[0]; - const auto &out_shape = out->get_shape(); +bool ngraph::op::v1::SpaceToBatch::evaluate(const HostTensorVector& outputs, + const HostTensorVector& inputs) const +{ + const auto& data = inputs[0]; + const auto& out = outputs[0]; + const auto& out_shape = out->get_shape(); size_t elem_size = data->get_element_type().size(); - if (data->get_partial_shape().is_dynamic()) { + if (data->get_partial_shape().is_dynamic()) + { return false; } auto data_shape = data->get_shape(); - if (!(data->get_shape().size() == 4 || data->get_shape().size() == 5)) { + if (!(data->get_shape().size() == 4 || data->get_shape().size() == 5)) + { return false; } size_t block_values_size = shape_size(inputs[1]->get_shape()); - const auto *block_values = inputs[1]->get_data_ptr(); - const auto *pads_begin = inputs[2]->get_data_ptr(); - const auto *pads_end = inputs[3]->get_data_ptr(); + const auto* block_values = inputs[1]->get_data_ptr(); + const auto* pads_begin = inputs[2]->get_data_ptr(); + const auto* pads_end = inputs[3]->get_data_ptr(); const char* pad_value = nullptr; const std::vector pad_zero_value(elem_size, 0); @@ -176,7 +180,8 @@ bool ngraph::op::v1::SpaceToBatch::evaluate(const HostTensorVector& outputs, con pads_end_vec.assign(pads_end, pads_end + shape_size(inputs[2]->get_shape())); Shape padded_shape(data_shape.size()); - for (size_t i = 0; i < data_shape.size(); ++i) { + for (size_t i = 0; i < data_shape.size(); ++i) + { padded_shape[i] = data_shape[i] + pads_begin_vec[i] + pads_end_vec[i]; } @@ -202,19 +207,26 @@ bool ngraph::op::v1::SpaceToBatch::evaluate(const HostTensorVector& outputs, con std::vector dispersed_data(shape_size(data_shape) * elem_size); std::vector post_transpose_data(shape_size(data_shape) * elem_size); - for (int64_t block_idx = block_values_size - 1; block_idx >= 0; --block_idx) { + for (int64_t block_idx = block_values_size - 1; block_idx >= 0; --block_idx) + { int64_t sq_shape_idx = block_values_size - 1; int64_t axis_idx = axes_order.size() - 1; - for (int64_t shape_idx = dispersed_shape.size() - 1; shape_idx >= 0; --shape_idx) { - if (shape_idx == (block_idx + 1)) { + for (int64_t shape_idx = dispersed_shape.size() - 1; shape_idx >= 0; --shape_idx) + { + if (shape_idx == (block_idx + 1)) + { dispersed_shape[shape_idx] = block_values[block_idx]; axes_order[0] = shape_idx; - } else if (shape_idx == block_idx) { - dispersed_shape[shape_idx] = squeezed_shape[sq_shape_idx]/block_values[block_idx]; + } + else if (shape_idx == block_idx) + { + dispersed_shape[shape_idx] = squeezed_shape[sq_shape_idx] / block_values[block_idx]; axes_order[axis_idx] = shape_idx; axis_idx--; sq_shape_idx--; - } else { + } + else + { dispersed_shape[shape_idx] = squeezed_shape[sq_shape_idx]; axes_order[axis_idx] = shape_idx; axis_idx--; @@ -222,20 +234,33 @@ bool ngraph::op::v1::SpaceToBatch::evaluate(const HostTensorVector& outputs, con } } - runtime::opt_kernel::reshape(flat_data.data(), dispersed_data.data(), data_shape, plain_axes_order, dispersed_shape, + runtime::opt_kernel::reshape(flat_data.data(), + dispersed_data.data(), + data_shape, + plain_axes_order, + dispersed_shape, elem_size); Shape post_transpose_shape(axes_order.size()); - for (size_t i = 0; i < axes_order.size(); ++i) { + for (size_t i = 0; i < axes_order.size(); ++i) + { post_transpose_shape[i] = dispersed_shape[axes_order[i]]; } - runtime::opt_kernel::reshape(dispersed_data.data(), post_transpose_data.data(), dispersed_shape, axes_order, - post_transpose_shape, elem_size); + runtime::opt_kernel::reshape(dispersed_data.data(), + post_transpose_data.data(), + dispersed_shape, + axes_order, + post_transpose_shape, + elem_size); squeezed_shape[0] *= block_values[block_idx]; squeezed_shape[block_idx] /= block_values[block_idx]; - runtime::opt_kernel::reshape(post_transpose_data.data(), flat_data.data(), post_transpose_shape, plain_axes_order, - squeezed_shape, elem_size); + runtime::opt_kernel::reshape(post_transpose_data.data(), + flat_data.data(), + post_transpose_shape, + plain_axes_order, + squeezed_shape, + elem_size); data_shape = squeezed_shape; } diff --git a/ngraph/core/src/op/space_to_depth.cpp b/ngraph/core/src/op/space_to_depth.cpp index b2d845815134fb..6b043f03664454 100644 --- a/ngraph/core/src/op/space_to_depth.cpp +++ b/ngraph/core/src/op/space_to_depth.cpp @@ -20,8 +20,8 @@ #include "ngraph/attribute_visitor.hpp" #include "ngraph/builder/reshape.hpp" -#include "ngraph/shape.hpp" #include "ngraph/op/space_to_depth.hpp" +#include "ngraph/shape.hpp" #include "ngraph/runtime/opt_kernel/reshape.hpp" @@ -155,13 +155,16 @@ shared_ptr op::SpaceToDepth::clone_with_new_inputs(const OutputVector& new return make_shared(new_args.at(0), m_mode, m_blocksize); } -bool ngraph::op::v0::SpaceToDepth::evaluate(const HostTensorVector& outputs, const HostTensorVector& inputs) const { - const auto &data = inputs[0]; - const auto &out = outputs[0]; - const auto &out_shape = out->get_shape(); +bool ngraph::op::v0::SpaceToDepth::evaluate(const HostTensorVector& outputs, + const HostTensorVector& inputs) const +{ + const auto& data = inputs[0]; + const auto& out = outputs[0]; + const auto& out_shape = out->get_shape(); size_t elem_size = data->get_element_type().size(); - if (data->get_partial_shape().is_dynamic()) { + if (data->get_partial_shape().is_dynamic()) + { return false; } auto data_shape = data->get_shape(); @@ -170,7 +173,8 @@ bool ngraph::op::v0::SpaceToDepth::evaluate(const HostTensorVector& outputs, con const size_t spatial_dim_index = 2; const size_t spatial_dims = data_shape.size() - spatial_dim_index; - for (int i = spatial_dim_index; i < data_shape.size(); ++i) { + for (int i = spatial_dim_index; i < data_shape.size(); ++i) + { NODE_VALIDATION_CHECK(this, m_blocksize > 0 && data_shape.at(i) % m_blocksize == 0, "The dimension on position: ", @@ -185,7 +189,8 @@ bool ngraph::op::v0::SpaceToDepth::evaluate(const HostTensorVector& outputs, con // rearrange them so as appropriate chunks of data where close to their // destination place. Finally squeeze data from respective dimensions. Shape dispersed_shape{n_dim, c_dim}; - for (int i = 0; i < spatial_dims; ++i) { + for (int i = 0; i < spatial_dims; ++i) + { dispersed_shape.push_back(data_shape.at(i + spatial_dim_index) / m_blocksize); dispersed_shape.push_back(m_blocksize); } @@ -201,36 +206,40 @@ bool ngraph::op::v0::SpaceToDepth::evaluate(const HostTensorVector& outputs, con // calculate axes to transpose // [0, 3, 5, ..., spatial_dims + (spatial_dims + 1), 2, 4, ..., K + K]) vector axes_order{0}; - for (size_t i = 0, j = 3; i < spatial_dims; ++i, j += 2) { + for (size_t i = 0, j = 3; i < spatial_dims; ++i, j += 2) + { axes_order.push_back(j); } - for (size_t i = 0, j = 2; i < spatial_dims; ++i, j += 2) { + for (size_t i = 0, j = 2; i < spatial_dims; ++i, j += 2) + { axes_order.push_back(j); } - switch (m_mode) { - // x' = reshape(data, [N, C, D1/block_size, block_size, D2/block_size, block_size, ..., - // DK/block_size, block_size]) - // x'' = transpose(x', [0, 1, 3, 5, ..., K + (K + 1), 2, 4, ..., K + K]) - // y = reshape(x'', [N, C * (block_size ^ K), D1 / block_size, D2 / block_size, ..., DK / - // block_size]) - case SpaceToDepthMode::DEPTH_FIRST: { - axes_order.insert(axes_order.begin() + 1, 1); - break; - } - // x' = reshape(data, [N, C, D1/block_size, block_size, D2/block_size, block_size, ... , - // DK/block_size, block_size]) - // x'' = transpose(x', [0, 3, 5, ..., K + (K + 1), 1, 2, 4, ..., K + K]) - // y = reshape(x'', [N, C * (block_size ^ K), D1 / block_size, D2 / block_size, ..., DK / - // block_size]) - case SpaceToDepthMode::BLOCKS_FIRST: - default: { - axes_order.insert(axes_order.begin() + spatial_dims + 1, 1); - } + switch (m_mode) + { + // x' = reshape(data, [N, C, D1/block_size, block_size, D2/block_size, block_size, ..., + // DK/block_size, block_size]) + // x'' = transpose(x', [0, 1, 3, 5, ..., K + (K + 1), 2, 4, ..., K + K]) + // y = reshape(x'', [N, C * (block_size ^ K), D1 / block_size, D2 / block_size, ..., DK / + // block_size]) + case SpaceToDepthMode::DEPTH_FIRST: + { + axes_order.insert(axes_order.begin() + 1, 1); + break; + } + // x' = reshape(data, [N, C, D1/block_size, block_size, D2/block_size, block_size, ... , + // DK/block_size, block_size]) + // x'' = transpose(x', [0, 3, 5, ..., K + (K + 1), 1, 2, 4, ..., K + K]) + // y = reshape(x'', [N, C * (block_size ^ K), D1 / block_size, D2 / block_size, ..., DK / + // block_size]) + case SpaceToDepthMode::BLOCKS_FIRST: + default: { axes_order.insert(axes_order.begin() + spatial_dims + 1, 1); + } } std::vector transposed_data(shape_size(data_shape) * elem_size); Shape post_transpose_shape(axes_order.size()); - for (size_t axis_idx = 0; axis_idx < axes_order.size(); ++axis_idx) { + for (size_t axis_idx = 0; axis_idx < axes_order.size(); ++axis_idx) + { post_transpose_shape[axis_idx] = dispersed_shape[axes_order[axis_idx]]; } @@ -247,16 +256,17 @@ bool ngraph::op::v0::SpaceToDepth::evaluate(const HostTensorVector& outputs, con squeezed_shape.push_back(data_shape.at(spatial_dim_index + i) / m_blocksize); } squeezed_shape.insert(squeezed_shape.begin() + 1, c_dim * std::pow(m_blocksize, spatial_dims)); - for (size_t i = plain_axes_order.size() - 1; i < post_transpose_shape.size() - 1 ; ++i) { + for (size_t i = plain_axes_order.size() - 1; i < post_transpose_shape.size() - 1; ++i) + { plain_axes_order.push_back(plain_axes_order[i] + 1); } runtime::opt_kernel::reshape(transposed_data.data(), out->get_data_ptr(), post_transpose_shape, plain_axes_order, - squeezed_shape, elem_size); + squeezed_shape, + elem_size); return true; - } namespace ngraph diff --git a/ngraph/core/src/op/subtract.cpp b/ngraph/core/src/op/subtract.cpp index 11292ca6f7bbff..b68f0acbd930b4 100644 --- a/ngraph/core/src/op/subtract.cpp +++ b/ngraph/core/src/op/subtract.cpp @@ -30,47 +30,46 @@ shared_ptr ngraph::operator-(const Output arg0, const Output return make_shared(arg0, arg1); } +template +bool evaluate(const HostTensorPtr& arg0, + const HostTensorPtr& arg1, + const HostTensorPtr& out, + const op::AutoBroadcastSpec& broadcast_spec) +{ + runtime::reference::subtract(arg0->get_data_ptr(), + arg1->get_data_ptr(), + out->get_data_ptr(), + arg0->get_shape(), + arg1->get_shape(), + broadcast_spec); + return true; +} - template - bool evaluate(const HostTensorPtr& arg0, - const HostTensorPtr& arg1, - const HostTensorPtr& out, - const op::AutoBroadcastSpec& broadcast_spec) - { - runtime::reference::subtract(arg0->get_data_ptr(), - arg1->get_data_ptr(), - out->get_data_ptr(), - arg0->get_shape(), - arg1->get_shape(), - broadcast_spec); - return true; - } - - bool evaluate_subtract(const HostTensorPtr& arg0, - const HostTensorPtr& arg1, - const HostTensorPtr& out, - const op::AutoBroadcastSpec& broadcast_spec) +bool evaluate_subtract(const HostTensorPtr& arg0, + const HostTensorPtr& arg1, + const HostTensorPtr& out, + const op::AutoBroadcastSpec& broadcast_spec) +{ + bool rc = true; + out->set_broadcast(broadcast_spec, arg0, arg1); + switch (arg0->get_element_type()) { - bool rc = true; - out->set_broadcast(broadcast_spec, arg0, arg1); - switch (arg0->get_element_type()) - { - TYPE_CASE(i32)(arg0, arg1, out, broadcast_spec); - break; - TYPE_CASE(i64)(arg0, arg1, out, broadcast_spec); - break; - TYPE_CASE(u32)(arg0, arg1, out, broadcast_spec); - break; - TYPE_CASE(u64)(arg0, arg1, out, broadcast_spec); - break; - TYPE_CASE(f16)(arg0, arg1, out, broadcast_spec); - break; - TYPE_CASE(f32)(arg0, arg1, out, broadcast_spec); - break; - default: rc = false; break; - } - return rc; + TYPE_CASE(i32)(arg0, arg1, out, broadcast_spec); + break; + TYPE_CASE(i64)(arg0, arg1, out, broadcast_spec); + break; + TYPE_CASE(u32)(arg0, arg1, out, broadcast_spec); + break; + TYPE_CASE(u64)(arg0, arg1, out, broadcast_spec); + break; + TYPE_CASE(f16)(arg0, arg1, out, broadcast_spec); + break; + TYPE_CASE(f32)(arg0, arg1, out, broadcast_spec); + break; + default: rc = false; break; } + return rc; +} // ------------------------------- v1 ------------------------------------------ diff --git a/ngraph/test/backend/convolution.in.cpp b/ngraph/test/backend/convolution.in.cpp index 546f6419b4a7d9..20636a2b4fec0d 100644 --- a/ngraph/test/backend/convolution.in.cpp +++ b/ngraph/test/backend/convolution.in.cpp @@ -37,18 +37,10 @@ NGRAPH_TEST(${BACKEND_NAME}, convolution_outlining) Shape shape_b{2, 2, 1, 1}; auto B = make_shared(element::f32, shape_b); Shape shape_r{1, 2, 2, 2}; - auto conv1 = make_shared(A, - B, - Strides{1, 1}, - CoordinateDiff{0, 0}, - CoordinateDiff{0, 0}, - Strides{1, 1}); - auto conv2 = make_shared(conv1, - B, - Strides{1, 1}, - CoordinateDiff{0, 0}, - CoordinateDiff{0, 0}, - Strides{1, 1}); + auto conv1 = make_shared( + A, B, Strides{1, 1}, CoordinateDiff{0, 0}, CoordinateDiff{0, 0}, Strides{1, 1}); + auto conv2 = make_shared( + conv1, B, Strides{1, 1}, CoordinateDiff{0, 0}, CoordinateDiff{0, 0}, Strides{1, 1}); auto f = make_shared(conv2, ParameterVector{A, B}); auto backend = runtime::Backend::create("${BACKEND_NAME}"); @@ -74,12 +66,8 @@ NGRAPH_TEST(${BACKEND_NAME}, convolution_simple) Shape shape_b{2, 2, 1, 1}; auto B = make_shared(element::f32, shape_b); Shape shape_r{1, 2, 2, 2}; - auto conv1 = make_shared(A, - B, - Strides{1, 1}, - CoordinateDiff{0, 0}, - CoordinateDiff{0, 0}, - Strides{1, 1}); + auto conv1 = make_shared( + A, B, Strides{1, 1}, CoordinateDiff{0, 0}, CoordinateDiff{0, 0}, Strides{1, 1}); auto f = make_shared(conv1, ParameterVector{A, B}); @@ -106,12 +94,8 @@ NGRAPH_TEST(${BACKEND_NAME}, convolution_simple_padding) Shape shape_b{1, 1, 1, 1}; auto B = make_shared(element::f32, shape_b); Shape shape_r{1, 1, 5, 5}; - auto conv1 = make_shared(A, - B, - Strides{1, 1}, - CoordinateDiff{1, 1}, - CoordinateDiff{2, 2}, - Strides{1, 1}); + auto conv1 = make_shared( + A, B, Strides{1, 1}, CoordinateDiff{1, 1}, CoordinateDiff{2, 2}, Strides{1, 1}); auto f = make_shared(conv1, ParameterVector{A, B}); diff --git a/ngraph/test/backend/fused_op.in.cpp b/ngraph/test/backend/fused_op.in.cpp index f0ae7a9d4f8765..b922cbe1ea1e10 100644 --- a/ngraph/test/backend/fused_op.in.cpp +++ b/ngraph/test/backend/fused_op.in.cpp @@ -1163,7 +1163,7 @@ NGRAPH_TEST(${BACKEND_NAME}, mvn_mean_variance_normalization_split_channels) test_case.run(); } -//TODO: Issue: 37514 +// TODO: Issue: 37514 NGRAPH_TEST(${BACKEND_NAME}, DISABLED_grn_4d) { const Shape data_shape{1, 2, 3, 4}; diff --git a/ngraph/test/backend/gather.in.cpp b/ngraph/test/backend/gather.in.cpp index ab7c7f7054ca32..8c87794b79e523 100644 --- a/ngraph/test/backend/gather.in.cpp +++ b/ngraph/test/backend/gather.in.cpp @@ -40,7 +40,6 @@ using namespace ngraph; static string s_manifest = "${MANIFEST}"; - NGRAPH_TEST(${BACKEND_NAME}, gather_4d_indices_no_axis_uint8) { Shape params_shape{3, 2}; diff --git a/ngraph/test/backend/zero_sized.in.cpp b/ngraph/test/backend/zero_sized.in.cpp index 5d71c690a17bff..9d9552f050f6e3 100644 --- a/ngraph/test/backend/zero_sized.in.cpp +++ b/ngraph/test/backend/zero_sized.in.cpp @@ -33,11 +33,11 @@ using namespace ngraph; static string s_manifest = "${MANIFEST}"; static const std::vector base_types = { - ngraph::element::from(), - ngraph::element::from(), - ngraph::element::from(), - ngraph::element::from(), - ngraph::element::from(), + ngraph::element::from(), + ngraph::element::from(), + ngraph::element::from(), + ngraph::element::from(), + ngraph::element::from(), }; template diff --git a/ngraph/test/onnx/onnx_import_quant.in.cpp b/ngraph/test/onnx/onnx_import_quant.in.cpp index 1f033a7aff912a..842c1df4fc4a7c 100644 --- a/ngraph/test/onnx/onnx_import_quant.in.cpp +++ b/ngraph/test/onnx/onnx_import_quant.in.cpp @@ -225,7 +225,8 @@ NGRAPH_TEST(${BACKEND_NAME}, DISABLED_onnx_model_dequantize_linear_1d_zero_scale test_case.run(); } -NGRAPH_TEST(${BACKEND_NAME}, DISABLED_onnx_model_dequantize_linear_1d_zero_scale_uint8_negative_axis) +NGRAPH_TEST(${BACKEND_NAME}, + DISABLED_onnx_model_dequantize_linear_1d_zero_scale_uint8_negative_axis) { auto function = onnx_import::import_onnx_model( file_util::path_join(SERIALIZED_ZOO, "onnx/dequantize_linear_5.prototxt")); diff --git a/ngraph/test/runtime/backend.cpp b/ngraph/test/runtime/backend.cpp index 6a9cd50bbc7b0f..af039d593db18f 100644 --- a/ngraph/test/runtime/backend.cpp +++ b/ngraph/test/runtime/backend.cpp @@ -24,9 +24,9 @@ #include "backend.hpp" #include "backend_manager.hpp" +#include "dynamic/dynamic_backend.hpp" #include "ngraph/file_util.hpp" #include "ngraph/util.hpp" -#include "dynamic/dynamic_backend.hpp" using namespace std; using namespace ngraph; diff --git a/ngraph/test/runtime/interpreter/evaluates_map.cpp b/ngraph/test/runtime/interpreter/evaluates_map.cpp index 2452a5417de61d..de3ab3c8711d23 100644 --- a/ngraph/test/runtime/interpreter/evaluates_map.cpp +++ b/ngraph/test/runtime/interpreter/evaluates_map.cpp @@ -15,265 +15,287 @@ //***************************************************************************** #include "evaluates_map.hpp" -#include "ngraph/ops.hpp" -#include "ngraph/runtime/reference/convolution.hpp" -#include "ngraph/runtime/reference/cum_sum.hpp" -#include "ngraph/runtime/reference/embedding_segments_sum.hpp" -#include "ngraph/runtime/reference/embedding_bag_offsets_sum.hpp" -#include "ngraph/runtime/reference/embedding_bag_packed_sum.hpp" -#include "ngraph/runtime/reference/mvn.hpp" -#include "ngraph/runtime/reference/lrn.hpp" -#include "ngraph/runtime/reference/avg_pool.hpp" +#include +#include #include -#include #include -#include -#include -#include -#include #include -#include -#include #include -#include #include -#include -#include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include "ngraph/ops.hpp" +#include "ngraph/runtime/reference/avg_pool.hpp" +#include "ngraph/runtime/reference/batch_norm.hpp" +#include "ngraph/runtime/reference/batch_norm.hpp" +#include "ngraph/runtime/reference/convolution.hpp" +#include "ngraph/runtime/reference/ctc_loss.hpp" +#include "ngraph/runtime/reference/cum_sum.hpp" #include "ngraph/runtime/reference/detection_output.hpp" +#include "ngraph/runtime/reference/embedding_bag_offsets_sum.hpp" +#include "ngraph/runtime/reference/embedding_bag_packed_sum.hpp" +#include "ngraph/runtime/reference/embedding_segments_sum.hpp" +#include "ngraph/runtime/reference/gather_tree.hpp" +#include "ngraph/runtime/reference/lrn.hpp" +#include "ngraph/runtime/reference/mvn.hpp" +#include "ngraph/runtime/reference/reverse_sequence.hpp" #include "ngraph/runtime/reference/scatter_nd_update.hpp" +#include "reference/elu.hpp" #include "reference/gelu.hpp" #include "reference/hard_sigmoid.hpp" -#include "reference/elu.hpp" #include "reference/selu.hpp" -#include "ngraph/runtime/reference/ctc_loss.hpp" -#include "ngraph/runtime/reference/batch_norm.hpp" -#include "ngraph/runtime/reference/batch_norm.hpp" -#include "ngraph/runtime/reference/reverse_sequence.hpp" -#include "ngraph/runtime/reference/gather_tree.hpp" using namespace ngraph; using namespace std; -namespace { - template - bool evaluate(shared_ptr op, const HostTensorVector &outputs, const HostTensorVector &inputs) { +namespace +{ + template + bool evaluate(shared_ptr op, + const HostTensorVector& outputs, + const HostTensorVector& inputs) + { return false; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &inputs) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& inputs) + { const auto filter_data = inputs[1]->get_data_ptr(); auto out_data_ptr = outputs[0]->get_data_ptr(); const auto in_data_ptr = inputs[0]->get_data_ptr(); - const auto &out_shape = outputs[0]->get_shape(); - const auto &in_shape = inputs[0]->get_shape(); - const auto &filter_shape = inputs[1]->get_shape(); + const auto& out_shape = outputs[0]->get_shape(); + const auto& in_shape = inputs[0]->get_shape(); + const auto& filter_shape = inputs[1]->get_shape(); Strides in_dilation(std::vector(in_shape.size() - 2)); std::fill(in_dilation.begin(), in_dilation.end(), 1); - runtime::reference::convolution::value_type>(in_data_ptr, filter_data, - out_data_ptr, - in_shape, - filter_shape, - out_shape, - op->get_strides(), - op->get_dilations(), - op->get_pads_begin(), - op->get_pads_end(), - in_dilation); + runtime::reference::convolution::value_type>( + in_data_ptr, + filter_data, + out_data_ptr, + in_shape, + filter_shape, + out_shape, + op->get_strides(), + op->get_dilations(), + op->get_pads_begin(), + op->get_pads_end(), + in_dilation); return true; } - - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &inputs) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& inputs) + { const auto filter_data = inputs[1]->get_data_ptr(); auto out_data_ptr = outputs[0]->get_data_ptr(); const auto in_data_ptr = inputs[0]->get_data_ptr(); - const auto &out_shape = outputs[0]->get_shape(); - const auto &in_shape = inputs[0]->get_shape(); - const auto &filter_shape = inputs[1]->get_shape(); + const auto& out_shape = outputs[0]->get_shape(); + const auto& in_shape = inputs[0]->get_shape(); + const auto& filter_shape = inputs[1]->get_shape(); Strides in_dilation(std::vector(in_shape.size() - 2)); std::fill(in_dilation.begin(), in_dilation.end(), 1); - runtime::reference::convolution_backprop_in::value_type>(in_data_ptr, - filter_data, - out_data_ptr, - in_shape, - filter_shape, - out_shape, - in_dilation, - op->get_dilations(), - op->get_pads_begin(), - op->get_pads_end(), - op->get_strides()); + runtime::reference::convolution_backprop_in::value_type>( + in_data_ptr, + filter_data, + out_data_ptr, + in_shape, + filter_shape, + out_shape, + in_dilation, + op->get_dilations(), + op->get_pads_begin(), + op->get_pads_end(), + op->get_strides()); return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &inputs) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& inputs) + { const auto filter_data = inputs[1]->get_data_ptr(); auto out_data_ptr = outputs[0]->get_data_ptr(); const auto in_data_ptr = inputs[0]->get_data_ptr(); - const auto &out_shape = outputs[0]->get_shape(); - const auto &in_shape = inputs[0]->get_shape(); - const auto &filter_shape = inputs[1]->get_shape(); + const auto& out_shape = outputs[0]->get_shape(); + const auto& in_shape = inputs[0]->get_shape(); + const auto& filter_shape = inputs[1]->get_shape(); Strides in_dilation(std::vector(in_shape.size() - 2)); std::fill(in_dilation.begin(), in_dilation.end(), 1); - runtime::reference::convolution::value_type>(in_data_ptr, filter_data, - out_data_ptr, - in_shape, - filter_shape, - out_shape, - op->get_strides(), - op->get_dilations(), - op->get_pads_begin(), - op->get_pads_end(), - in_dilation, - filter_shape.at(0)); + runtime::reference::convolution::value_type>( + in_data_ptr, + filter_data, + out_data_ptr, + in_shape, + filter_shape, + out_shape, + op->get_strides(), + op->get_dilations(), + op->get_pads_begin(), + op->get_pads_end(), + in_dilation, + filter_shape.at(0)); return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &inputs) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& inputs) + { const auto filter_data = inputs[1]->get_data_ptr(); auto out_data_ptr = outputs[0]->get_data_ptr(); const auto in_data_ptr = inputs[0]->get_data_ptr(); - const auto &out_shape = outputs[0]->get_shape(); - const auto &in_shape = inputs[0]->get_shape(); - const auto &filter_shape = inputs[1]->get_shape(); + const auto& out_shape = outputs[0]->get_shape(); + const auto& in_shape = inputs[0]->get_shape(); + const auto& filter_shape = inputs[1]->get_shape(); Strides in_dilation(std::vector(in_shape.size() - 2)); std::fill(in_dilation.begin(), in_dilation.end(), 1); - runtime::reference::convolution_backprop_in::value_type>(in_data_ptr, - filter_data, - out_data_ptr, - in_shape, - filter_shape, - out_shape, - in_dilation, - op->get_dilations(), - op->get_pads_begin(), - op->get_pads_end(), - op->get_strides(), - filter_shape.at(0)); + runtime::reference::convolution_backprop_in::value_type>( + in_data_ptr, + filter_data, + out_data_ptr, + in_shape, + filter_shape, + out_shape, + in_dilation, + op->get_dilations(), + op->get_pads_begin(), + op->get_pads_end(), + op->get_strides(), + filter_shape.at(0)); return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &inputs) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& inputs) + { using T = typename element_type_traits::value_type; -#define REF_CALL(U) \ - runtime::reference::cumsum::value_type>( \ - inputs[0]->get_data_ptr(),\ - inputs[1]->get_data_ptr(), \ - outputs[0]->get_data_ptr(), \ - inputs[0]->get_shape(), \ - op->is_exclusive(), \ - op->is_reverse()); \ - break; - - switch (inputs[1]->get_element_type()) { - case element::Type_t::i64: { - REF_CALL(element::Type_t::i64); - } - default: - REF_CALL(element::Type_t::i32); +#define REF_CALL(U) \ + runtime::reference::cumsum::value_type>( \ + inputs[0]->get_data_ptr(), \ + inputs[1]->get_data_ptr(), \ + outputs[0]->get_data_ptr(), \ + inputs[0]->get_shape(), \ + op->is_exclusive(), \ + op->is_reverse()); \ + break; + + switch (inputs[1]->get_element_type()) + { + case element::Type_t::i64: { REF_CALL(element::Type_t::i64); + } + default: REF_CALL(element::Type_t::i32); } #undef REF_CALL return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &inputs) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& inputs) + { using T = typename element_type_traits::value_type; -#define REF_CALL(elType) \ - runtime::reference::embeddingSegmentsSum::value_type>( \ - inputs[0]->get_data_ptr(), \ - inputs[1]->get_data_ptr(), \ - inputs[2]->get_data_ptr(), \ - inputs.size() > 4 ? inputs[4]->get_data_ptr() : nullptr, \ - inputs.size() > 5 ? inputs[5]->get_data_ptr() : nullptr, \ - outputs[0]->get_data_ptr(), \ - inputs[0]->get_shape(), \ - inputs[1]->get_shape(), \ - outputs[0]->get_shape()); \ - break; - - switch (inputs[1]->get_element_type()) { - case element::Type_t::i32: - REF_CALL(element::Type_t::i32); - case element::Type_t::i64: - REF_CALL(element::Type_t::i64); - default: - return false; +#define REF_CALL(elType) \ + runtime::reference::embeddingSegmentsSum::value_type>( \ + inputs[0]->get_data_ptr(), \ + inputs[1]->get_data_ptr(), \ + inputs[2]->get_data_ptr(), \ + inputs.size() > 4 ? inputs[4]->get_data_ptr() : nullptr, \ + inputs.size() > 5 ? inputs[5]->get_data_ptr() : nullptr, \ + outputs[0]->get_data_ptr(), \ + inputs[0]->get_shape(), \ + inputs[1]->get_shape(), \ + outputs[0]->get_shape()); \ + break; + + switch (inputs[1]->get_element_type()) + { + case element::Type_t::i32: REF_CALL(element::Type_t::i32); + case element::Type_t::i64: REF_CALL(element::Type_t::i64); + default: return false; } #undef REF_CALL return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &inputs) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& inputs) + { using T = typename element_type_traits::value_type; -#define REF_CALL(elType) \ - runtime::reference::embeddingBagOffsetsSum::value_type>( \ - inputs[0]->get_data_ptr(), \ - inputs[1]->get_data_ptr(), \ - inputs[2]->get_data_ptr(), \ - inputs.size() > 3 ? inputs[3]->get_data_ptr() : nullptr, \ - inputs.size() > 4 ? inputs[4]->get_data_ptr() : nullptr, \ - outputs[0]->get_data_ptr(), \ - shape_size(inputs[1]->get_shape()), \ - outputs[0]->get_shape()); \ - break; - - switch (inputs[1]->get_element_type()) { - case element::Type_t::i32: - REF_CALL(element::Type_t::i32); - case element::Type_t::i64: - REF_CALL(element::Type_t::i64); - default: - return false; +#define REF_CALL(elType) \ + runtime::reference::embeddingBagOffsetsSum::value_type>( \ + inputs[0]->get_data_ptr(), \ + inputs[1]->get_data_ptr(), \ + inputs[2]->get_data_ptr(), \ + inputs.size() > 3 ? inputs[3]->get_data_ptr() : nullptr, \ + inputs.size() > 4 ? inputs[4]->get_data_ptr() : nullptr, \ + outputs[0]->get_data_ptr(), \ + shape_size(inputs[1]->get_shape()), \ + outputs[0]->get_shape()); \ + break; + + switch (inputs[1]->get_element_type()) + { + case element::Type_t::i32: REF_CALL(element::Type_t::i32); + case element::Type_t::i64: REF_CALL(element::Type_t::i64); + default: return false; } #undef REF_CALL return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &inputs) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& inputs) + { using T = typename element_type_traits::value_type; -#define REF_CALL(elType) \ - runtime::reference::embeddingBagPackedSum::value_type>( \ - inputs[0]->get_data_ptr(), \ - inputs[1]->get_data_ptr(), \ - inputs.size() > 2 ? inputs[2]->get_data_ptr() : nullptr, \ - outputs[0]->get_data_ptr(), \ - inputs[1]->get_shape(), \ - outputs[0]->get_shape()); \ - break; - - switch (inputs[1]->get_element_type()) { - case element::Type_t::i32: - REF_CALL(element::Type_t::i32); - case element::Type_t::i64: - REF_CALL(element::Type_t::i64); - default: - return false; +#define REF_CALL(elType) \ + runtime::reference::embeddingBagPackedSum::value_type>( \ + inputs[0]->get_data_ptr(), \ + inputs[1]->get_data_ptr(), \ + inputs.size() > 2 ? inputs[2]->get_data_ptr() : nullptr, \ + outputs[0]->get_data_ptr(), \ + inputs[1]->get_shape(), \ + outputs[0]->get_shape()); \ + break; + + switch (inputs[1]->get_element_type()) + { + case element::Type_t::i32: REF_CALL(element::Type_t::i32); + case element::Type_t::i64: REF_CALL(element::Type_t::i64); + default: return false; } #undef REF_CALL return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &inputs) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& inputs) + { using T = typename element_type_traits::value_type; runtime::reference::mvn(inputs[0]->get_data_ptr(), outputs[0]->get_data_ptr(), @@ -284,48 +306,65 @@ namespace { return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &inputs) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& inputs) + { using T = typename element_type_traits::value_type; - runtime::reference::lrn(inputs[0]->get_data_ptr(), op->get_reduction_axes(), - outputs[0]->get_data_ptr(), inputs[0]->get_shape(), - op->get_alpha(), op->get_beta(), op->get_bias(), op->get_nsize()); + runtime::reference::lrn(inputs[0]->get_data_ptr(), + op->get_reduction_axes(), + outputs[0]->get_data_ptr(), + inputs[0]->get_shape(), + op->get_alpha(), + op->get_beta(), + op->get_bias(), + op->get_nsize()); return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &input) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& input) + { using T = typename element_type_traits::value_type; runtime::reference::referenceDetectionOutput refDetOut( - op->get_attrs(), op->get_input_shape(0), op->get_input_shape(2)); - if (op->get_input_size() == 3) { + op->get_attrs(), op->get_input_shape(0), op->get_input_shape(2)); + if (op->get_input_size() == 3) + { refDetOut.run(input[0]->get_data_ptr(), input[1]->get_data_ptr(), input[2]->get_data_ptr(), nullptr, nullptr, outputs[0]->get_data_ptr()); - } else if (op->get_input_size() == 5) { + } + else if (op->get_input_size() == 5) + { refDetOut.run(input[0]->get_data_ptr(), input[1]->get_data_ptr(), input[2]->get_data_ptr(), input[3]->get_data_ptr(), input[4]->get_data_ptr(), outputs[0]->get_data_ptr()); - } else { + } + else + { throw ngraph_error("DetectionOutput layer supports only 3 or 5 inputs"); } return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &input) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& input) + { using T = typename element_type_traits::value_type; auto idxType = op->get_input_element_type(1); - if (idxType == element::i32) { + if (idxType == element::i32) + { runtime::reference::scatterNdUpdate(input[0]->get_data_ptr(), input[1]->get_data_ptr(), input[2]->get_data_ptr(), @@ -333,7 +372,9 @@ namespace { op->get_input_shape(0), op->get_input_shape(1), op->get_input_shape(2)); - } else if (idxType == element::i64) { + } + else if (idxType == element::i64) + { runtime::reference::scatterNdUpdate(input[0]->get_data_ptr(), input[1]->get_data_ptr(), input[2]->get_data_ptr(), @@ -341,16 +382,20 @@ namespace { op->get_input_shape(0), op->get_input_shape(1), op->get_input_shape(2)); - } else { + } + else + { throw ngraph_error( - "ScatterNDUpdate layer support only i32 and i64 'indices' input precision!"); + "ScatterNDUpdate layer support only i32 and i64 'indices' input precision!"); } return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &input) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& input) + { using T = typename element_type_traits::value_type; runtime::reference::select(input[0]->get_data_ptr(), input[1]->get_data_ptr(), @@ -363,9 +408,11 @@ namespace { return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &input) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& input) + { using T = typename element_type_traits::value_type; runtime::reference::avg_pool(input[0]->get_data_ptr(), outputs[0]->get_data_ptr(), @@ -379,9 +426,11 @@ namespace { return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &input) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& input) + { using T = typename element_type_traits::value_type; runtime::reference::hard_sigmoid(input[0]->get_data_ptr(), input[1]->get_data_ptr(), @@ -393,9 +442,11 @@ namespace { return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &input) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& input) + { using T = typename element_type_traits::value_type; runtime::reference::elu(input[0]->get_data_ptr(), outputs[0]->get_data_ptr(), @@ -404,9 +455,11 @@ namespace { return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &input) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& input) + { using T = typename element_type_traits::value_type; runtime::reference::selu(input[0]->get_data_ptr(), input[1]->get_data_ptr(), @@ -418,9 +471,11 @@ namespace { return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &input) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& input) + { using T = typename element_type_traits::value_type; runtime::reference::ceiling(input[0]->get_data_ptr(), outputs[0]->get_data_ptr(), @@ -428,9 +483,11 @@ namespace { return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &input) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& input) + { using T = typename element_type_traits::value_type; runtime::reference::gelu(input[0]->get_data_ptr(), outputs[0]->get_data_ptr(), @@ -438,39 +495,41 @@ namespace { return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &input) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& input) + { using T = typename element_type_traits::value_type; -#define REF_CALL(elType) \ - runtime::reference::CTCLoss::value_type>( \ - input[0]->get_data_ptr(), \ - input[0]->get_shape(), \ - input[1]->get_data_ptr(), \ - input[2]->get_data_ptr(), \ - input[3]->get_data_ptr(), \ - input[4]->get_data_ptr(), \ - op->get_preprocess_collapse_repeated(), \ - op->get_ctc_merge_repeated(), \ - op->get_unique(), \ - outputs[0]->get_data_ptr()); \ - break; - - switch (input[1]->get_element_type()) { - case element::Type_t::i32: - REF_CALL(element::Type_t::i32); - case element::Type_t::i64: - REF_CALL(element::Type_t::i64); - default: - return false; +#define REF_CALL(elType) \ + runtime::reference::CTCLoss::value_type>( \ + input[0]->get_data_ptr(), \ + input[0]->get_shape(), \ + input[1]->get_data_ptr(), \ + input[2]->get_data_ptr(), \ + input[3]->get_data_ptr(), \ + input[4]->get_data_ptr(), \ + op->get_preprocess_collapse_repeated(), \ + op->get_ctc_merge_repeated(), \ + op->get_unique(), \ + outputs[0]->get_data_ptr()); \ + break; + + switch (input[1]->get_element_type()) + { + case element::Type_t::i32: REF_CALL(element::Type_t::i32); + case element::Type_t::i64: REF_CALL(element::Type_t::i64); + default: return false; } #undef REF_CALL return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &input) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& input) + { using T = typename element_type_traits::value_type; runtime::reference::batch_norm_inference(op->get_eps_value(), input[0]->get_data_ptr(), @@ -483,138 +542,111 @@ namespace { return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &input) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& input) + { using T = typename element_type_traits::value_type; -#define REF_CALL(U) \ - runtime::reference::reverse_sequence::value_type>(\ - input[0]->get_data_ptr(),\ - outputs[0]->get_data_ptr(),\ - input[0]->get_shape(),\ - op->get_batch_axis(),\ - op->get_origin_sequence_axis(),\ - input[1]->get_data_ptr());\ - break; - - switch (input[1]->get_element_type()) { - case element::Type_t::boolean: - REF_CALL(element::Type_t::boolean) - case element::Type_t::i8: - REF_CALL(element::Type_t::i8); - case element::Type_t::i16: - REF_CALL(element::Type_t::i16); - case element::Type_t::i32: - REF_CALL(element::Type_t::i32); - case element::Type_t::i64: - REF_CALL(element::Type_t::i64); - case element::Type_t::u8: - REF_CALL(element::Type_t::u8); - case element::Type_t::u16: - REF_CALL(element::Type_t::u16); - case element::Type_t::u32: - REF_CALL(element::Type_t::u32); - case element::Type_t::u64: - REF_CALL(element::Type_t::u64); - case element::Type_t::f16: - REF_CALL(element::Type_t::f16); - case element::Type_t::f32: - REF_CALL(element::Type_t::f32); - case element::Type_t::f64: - REF_CALL(element::Type_t::f64); - default: - return false; +#define REF_CALL(U) \ + runtime::reference::reverse_sequence::value_type>( \ + input[0]->get_data_ptr(), \ + outputs[0]->get_data_ptr(), \ + input[0]->get_shape(), \ + op->get_batch_axis(), \ + op->get_origin_sequence_axis(), \ + input[1]->get_data_ptr()); \ + break; + + switch (input[1]->get_element_type()) + { + case element::Type_t::boolean: REF_CALL(element::Type_t::boolean) + case element::Type_t::i8: REF_CALL(element::Type_t::i8); + case element::Type_t::i16: REF_CALL(element::Type_t::i16); + case element::Type_t::i32: REF_CALL(element::Type_t::i32); + case element::Type_t::i64: REF_CALL(element::Type_t::i64); + case element::Type_t::u8: REF_CALL(element::Type_t::u8); + case element::Type_t::u16: REF_CALL(element::Type_t::u16); + case element::Type_t::u32: REF_CALL(element::Type_t::u32); + case element::Type_t::u64: REF_CALL(element::Type_t::u64); + case element::Type_t::f16: REF_CALL(element::Type_t::f16); + case element::Type_t::f32: REF_CALL(element::Type_t::f32); + case element::Type_t::f64: REF_CALL(element::Type_t::f64); + default: return false; } #undef REF_CALL return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &input) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& input) + { using TO = typename element_type_traits::value_type; - if (OUT_ET == element::Type_t::boolean) { -#define REF_CALL_BOOL(TI) \ - runtime::reference::convert_to_bool::value_type>(\ - input[0]->get_data_ptr(),\ - outputs[0]->get_data_ptr(),\ - shape_size(input[0]->get_shape())); \ - break; - switch (input[0]->get_element_type()) { - case element::Type_t::boolean: - REF_CALL_BOOL(element::Type_t::boolean); - case element::Type_t::i8: - REF_CALL_BOOL(element::Type_t::i8); - case element::Type_t::i16: - REF_CALL_BOOL(element::Type_t::i16); - case element::Type_t::i32: - REF_CALL_BOOL(element::Type_t::i32); - case element::Type_t::i64: - REF_CALL_BOOL(element::Type_t::i64); - case element::Type_t::u8: - REF_CALL_BOOL(element::Type_t::u8); - case element::Type_t::u16: - REF_CALL_BOOL(element::Type_t::u16); - case element::Type_t::u32: - REF_CALL_BOOL(element::Type_t::u32); - case element::Type_t::u64: - REF_CALL_BOOL(element::Type_t::u64); - case element::Type_t::f16: - REF_CALL_BOOL(element::Type_t::f16); - case element::Type_t::f32: - REF_CALL_BOOL(element::Type_t::f32); - case element::Type_t::f64: - REF_CALL_BOOL(element::Type_t::f64); - default: - return false; + if (OUT_ET == element::Type_t::boolean) + { +#define REF_CALL_BOOL(TI) \ + runtime::reference::convert_to_bool::value_type>( \ + input[0]->get_data_ptr(), \ + outputs[0]->get_data_ptr(), \ + shape_size(input[0]->get_shape())); \ + break; + switch (input[0]->get_element_type()) + { + case element::Type_t::boolean: REF_CALL_BOOL(element::Type_t::boolean); + case element::Type_t::i8: REF_CALL_BOOL(element::Type_t::i8); + case element::Type_t::i16: REF_CALL_BOOL(element::Type_t::i16); + case element::Type_t::i32: REF_CALL_BOOL(element::Type_t::i32); + case element::Type_t::i64: REF_CALL_BOOL(element::Type_t::i64); + case element::Type_t::u8: REF_CALL_BOOL(element::Type_t::u8); + case element::Type_t::u16: REF_CALL_BOOL(element::Type_t::u16); + case element::Type_t::u32: REF_CALL_BOOL(element::Type_t::u32); + case element::Type_t::u64: REF_CALL_BOOL(element::Type_t::u64); + case element::Type_t::f16: REF_CALL_BOOL(element::Type_t::f16); + case element::Type_t::f32: REF_CALL_BOOL(element::Type_t::f32); + case element::Type_t::f64: REF_CALL_BOOL(element::Type_t::f64); + default: return false; } #undef REF_CALL_BOOL - } else { -#define REF_CALL(TI) \ - runtime::reference::convert::value_type, TO>(\ - input[0]->get_data_ptr(),\ - outputs[0]->get_data_ptr(),\ - shape_size(input[0]->get_shape())); \ - break; - - switch (input[0]->get_element_type()) { - case element::Type_t::boolean: - REF_CALL(element::Type_t::boolean); - case element::Type_t::i8: - REF_CALL(element::Type_t::i8); - case element::Type_t::i16: - REF_CALL(element::Type_t::i16); - case element::Type_t::i32: - REF_CALL(element::Type_t::i32); - case element::Type_t::i64: - REF_CALL(element::Type_t::i64); - case element::Type_t::u8: - REF_CALL(element::Type_t::u8); - case element::Type_t::u16: - REF_CALL(element::Type_t::u16); - case element::Type_t::u32: - REF_CALL(element::Type_t::u32); - case element::Type_t::u64: - REF_CALL(element::Type_t::u64); - case element::Type_t::f16: - REF_CALL(element::Type_t::f16); - case element::Type_t::f32: - REF_CALL(element::Type_t::f32); - case element::Type_t::f64: - REF_CALL(element::Type_t::f64); - default: - return false; + } + else + { +#define REF_CALL(TI) \ + runtime::reference::convert::value_type, TO>( \ + input[0]->get_data_ptr(), \ + outputs[0]->get_data_ptr(), \ + shape_size(input[0]->get_shape())); \ + break; + + switch (input[0]->get_element_type()) + { + case element::Type_t::boolean: REF_CALL(element::Type_t::boolean); + case element::Type_t::i8: REF_CALL(element::Type_t::i8); + case element::Type_t::i16: REF_CALL(element::Type_t::i16); + case element::Type_t::i32: REF_CALL(element::Type_t::i32); + case element::Type_t::i64: REF_CALL(element::Type_t::i64); + case element::Type_t::u8: REF_CALL(element::Type_t::u8); + case element::Type_t::u16: REF_CALL(element::Type_t::u16); + case element::Type_t::u32: REF_CALL(element::Type_t::u32); + case element::Type_t::u64: REF_CALL(element::Type_t::u64); + case element::Type_t::f16: REF_CALL(element::Type_t::f16); + case element::Type_t::f32: REF_CALL(element::Type_t::f32); + case element::Type_t::f64: REF_CALL(element::Type_t::f64); + default: return false; } #undef REF_CALL } return true; } -// TODO: Rewrite to v1 - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &inputs) { + // TODO: Rewrite to v1 + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& inputs) + { using T = typename element_type_traits::value_type; runtime::reference::one_hot(inputs[0]->get_data_ptr(), outputs[0]->get_data_ptr(), @@ -624,10 +656,11 @@ namespace { return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &inputs) { - + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& inputs) + { using T = typename element_type_traits::value_type; runtime::reference::rnn_cell(inputs[0]->get_data_ptr(), inputs[0]->get_shape(), @@ -645,38 +678,13 @@ namespace { return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &inputs) { - - using T = typename element_type_traits::value_type; - runtime::reference::lstm_cell(inputs[0]->get_data_ptr(), - inputs[0]->get_shape(), - inputs[1]->get_data_ptr(), - inputs[1]->get_shape(), - inputs[2]->get_data_ptr(), - inputs[2]->get_shape(), - inputs[3]->get_data_ptr(), - inputs[3]->get_shape(), - inputs[4]->get_data_ptr(), - inputs[4]->get_shape(), - inputs[5]->get_data_ptr(), - inputs[5]->get_shape(), - outputs[0]->get_data_ptr(), - outputs[1]->get_data_ptr(), - op->get_activations()[0], - op->get_activations()[1], - op->get_activations()[2], - op->get_clip()); - return true; - } - - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &inputs) { - + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& inputs) + { using T = typename element_type_traits::value_type; - runtime::reference::gru_cell(inputs[0]->get_data_ptr(), + runtime::reference::lstm_cell(inputs[0]->get_data_ptr(), inputs[0]->get_shape(), inputs[1]->get_data_ptr(), inputs[1]->get_shape(), @@ -686,17 +694,46 @@ namespace { inputs[3]->get_shape(), inputs[4]->get_data_ptr(), inputs[4]->get_shape(), + inputs[5]->get_data_ptr(), + inputs[5]->get_shape(), outputs[0]->get_data_ptr(), + outputs[1]->get_data_ptr(), op->get_activations()[0], op->get_activations()[1], - op->get_clip(), - op->get_linear_before_reset()); + op->get_activations()[2], + op->get_clip()); + return true; + } + + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& inputs) + { + using T = typename element_type_traits::value_type; + runtime::reference::gru_cell(inputs[0]->get_data_ptr(), + inputs[0]->get_shape(), + inputs[1]->get_data_ptr(), + inputs[1]->get_shape(), + inputs[2]->get_data_ptr(), + inputs[2]->get_shape(), + inputs[3]->get_data_ptr(), + inputs[3]->get_shape(), + inputs[4]->get_data_ptr(), + inputs[4]->get_shape(), + outputs[0]->get_data_ptr(), + op->get_activations()[0], + op->get_activations()[1], + op->get_clip(), + op->get_linear_before_reset()); return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &inputs) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& inputs) + { using T = typename element_type_traits::value_type; runtime::reference::pad(inputs[0]->get_data_ptr(), inputs[1]->get_data_ptr(), @@ -710,9 +747,11 @@ namespace { return true; } - template - bool evaluate(const shared_ptr &op, const HostTensorVector &outputs, - const HostTensorVector &inputs) { + template + bool evaluate(const shared_ptr& op, + const HostTensorVector& outputs, + const HostTensorVector& inputs) + { using T = typename element_type_traits::value_type; runtime::reference::gather_tree(inputs[0]->get_data_ptr(), inputs[1]->get_data_ptr(), @@ -727,48 +766,56 @@ namespace { return true; } - - template - bool evaluate_node(std::shared_ptr node, const HostTensorVector &outputs, const HostTensorVector &inputs) { + template + bool evaluate_node(std::shared_ptr node, + const HostTensorVector& outputs, + const HostTensorVector& inputs) + { auto element_type = node->get_output_element_type(0); - for (size_t i = 1; i < node->outputs().size(); i++) { - if (element_type != node->get_output_element_type(i)) { + for (size_t i = 1; i < node->outputs().size(); i++) + { + if (element_type != node->get_output_element_type(i)) + { throw std::logic_error("Output node element types is not equal"); } } - switch (element_type) { - case element::Type_t::boolean: - return evaluate(as_type_ptr(node), outputs, inputs);; -// case element::Type_t::bf16: -// break; - case element::Type_t::f16: - return evaluate(as_type_ptr(node), outputs, inputs); - case element::Type_t::f64: - return evaluate(as_type_ptr(node), outputs, inputs); - case element::Type_t::f32: - return evaluate(as_type_ptr(node), outputs, inputs); - case element::Type_t::i8: - return evaluate(as_type_ptr(node), outputs, inputs); - case element::Type_t::i16: - return evaluate(as_type_ptr(node), outputs, inputs); - case element::Type_t::i32: - return evaluate(as_type_ptr(node), outputs, inputs); - case element::Type_t::i64: - return evaluate(as_type_ptr(node), outputs, inputs); - case element::Type_t::u8: - return evaluate(as_type_ptr(node), outputs, inputs); - case element::Type_t::u16: - return evaluate(as_type_ptr(node), outputs, inputs); - case element::Type_t::u32: - return evaluate(as_type_ptr(node), outputs, inputs); - default: - throw ngraph_error(std::string("Unhandled data type ") - + node->get_element_type().get_type_name() + std::string("in evaluate_node()")); + switch (element_type) + { + case element::Type_t::boolean: + return evaluate(as_type_ptr(node), outputs, inputs); + ; + // case element::Type_t::bf16: + // break; + case element::Type_t::f16: + return evaluate(as_type_ptr(node), outputs, inputs); + case element::Type_t::f64: + return evaluate(as_type_ptr(node), outputs, inputs); + case element::Type_t::f32: + return evaluate(as_type_ptr(node), outputs, inputs); + case element::Type_t::i8: + return evaluate(as_type_ptr(node), outputs, inputs); + case element::Type_t::i16: + return evaluate(as_type_ptr(node), outputs, inputs); + case element::Type_t::i32: + return evaluate(as_type_ptr(node), outputs, inputs); + case element::Type_t::i64: + return evaluate(as_type_ptr(node), outputs, inputs); + case element::Type_t::u8: + return evaluate(as_type_ptr(node), outputs, inputs); + case element::Type_t::u16: + return evaluate(as_type_ptr(node), outputs, inputs); + case element::Type_t::u32: + return evaluate(as_type_ptr(node), outputs, inputs); + default: + throw ngraph_error(std::string("Unhandled data type ") + + node->get_element_type().get_type_name() + + std::string("in evaluate_node()")); } } -} // namespace +} // namespace -runtime::interpreter::EvaluatorsMap &runtime::interpreter::get_evaluators_map() { +runtime::interpreter::EvaluatorsMap& runtime::interpreter::get_evaluators_map() +{ static runtime::interpreter::EvaluatorsMap evaluatorsMap{ #define NGRAPH_OP(NAME, NAMESPACE) {NAMESPACE::NAME::type_info, evaluate_node}, diff --git a/ngraph/test/runtime/interpreter/evaluates_map.hpp b/ngraph/test/runtime/interpreter/evaluates_map.hpp index 0b0411801545a5..893f88ed10242d 100644 --- a/ngraph/test/runtime/interpreter/evaluates_map.hpp +++ b/ngraph/test/runtime/interpreter/evaluates_map.hpp @@ -14,14 +14,19 @@ // limitations under the License. //***************************************************************************** #pragma once -#include "ngraph/node.hpp" #include "int_backend_visibility.hpp" -namespace ngraph { - namespace runtime { - namespace interpreter { - using EvaluatorsMap = std::map &node, - const ngraph::HostTensorVector &outputs, - const ngraph::HostTensorVector &inputs)>>; +#include "ngraph/node.hpp" +namespace ngraph +{ + namespace runtime + { + namespace interpreter + { + using EvaluatorsMap = + std::map& node, + const ngraph::HostTensorVector& outputs, + const ngraph::HostTensorVector& inputs)>>; EvaluatorsMap& get_evaluators_map(); } } diff --git a/ngraph/test/runtime/interpreter/int_executable.cpp b/ngraph/test/runtime/interpreter/int_executable.cpp index e9b53289a81686..40b3691f705d27 100644 --- a/ngraph/test/runtime/interpreter/int_executable.cpp +++ b/ngraph/test/runtime/interpreter/int_executable.cpp @@ -15,8 +15,8 @@ //***************************************************************************** #include "int_executable.hpp" -#include "evaluates_map.hpp" #include "backend_manager.hpp" +#include "evaluates_map.hpp" #include "ngraph/chrome_trace.hpp" #include "ngraph/except.hpp" #include "ngraph/ops.hpp" @@ -27,39 +27,44 @@ using namespace ngraph; NGRAPH_SUPPRESS_DEPRECATED_START - runtime::interpreter::INTExecutable::INTExecutable(const shared_ptr& function, bool enable_performance_collection) : m_is_compiled{true} , m_performance_counters_enabled{enable_performance_collection} { m_function = clone_function(*function); - for (const auto& node : m_function->get_ordered_ops()) { + for (const auto& node : m_function->get_ordered_ops()) + { // TODO: WA because of references mismatch for the operation - if (is_type(node)) { + if (is_type(node)) + { auto gr_conv_bp_data = dynamic_pointer_cast(node); auto num_groups = gr_conv_bp_data->input_value(1).get_shape()[0]; - auto split_filter_axis = std::make_shared(ngraph::element::Type_t::i64, ngraph::Shape{}, - std::vector{0}); - auto sliced_filter = std::make_shared(gr_conv_bp_data->input_value(1), split_filter_axis, - num_groups); - auto split_data_axis = std::make_shared(ngraph::element::Type_t::i64, ngraph::Shape{}, - std::vector{1}); - auto sliced_data = std::make_shared(gr_conv_bp_data->input_value(0), split_data_axis, num_groups); + auto split_filter_axis = std::make_shared( + ngraph::element::Type_t::i64, ngraph::Shape{}, std::vector{0}); + auto sliced_filter = std::make_shared( + gr_conv_bp_data->input_value(1), split_filter_axis, num_groups); + auto split_data_axis = std::make_shared( + ngraph::element::Type_t::i64, ngraph::Shape{}, std::vector{1}); + auto sliced_data = std::make_shared( + gr_conv_bp_data->input_value(0), split_data_axis, num_groups); NodeVector convs; - auto squeeze_filter_axis = std::make_shared(ngraph::element::Type_t::i64, ngraph::Shape{}, - std::vector{0}); - for (size_t i = 0; i < num_groups; ++i) { - auto squeezed_filter = std::make_shared(sliced_filter->output(i), squeeze_filter_axis); - auto conv = std::make_shared(sliced_data->output(i), - squeezed_filter, - gr_conv_bp_data->get_strides(), - gr_conv_bp_data->get_pads_begin(), - gr_conv_bp_data->get_pads_end(), - gr_conv_bp_data->get_dilations(), - gr_conv_bp_data->get_auto_pad(), - gr_conv_bp_data->get_output_padding()); + auto squeeze_filter_axis = std::make_shared( + ngraph::element::Type_t::i64, ngraph::Shape{}, std::vector{0}); + for (size_t i = 0; i < num_groups; ++i) + { + auto squeezed_filter = std::make_shared(sliced_filter->output(i), + squeeze_filter_axis); + auto conv = std::make_shared( + sliced_data->output(i), + squeezed_filter, + gr_conv_bp_data->get_strides(), + gr_conv_bp_data->get_pads_begin(), + gr_conv_bp_data->get_pads_end(), + gr_conv_bp_data->get_dilations(), + gr_conv_bp_data->get_auto_pad(), + gr_conv_bp_data->get_output_padding()); convs.push_back(conv); } auto concat = std::make_shared(convs, 1); @@ -165,8 +170,9 @@ bool runtime::interpreter::INTExecutable::call(const vectorget_input_element_type(0); } - else if (is_type(op) || is_type(op) || is_type(op) || - is_type(op) || is_type(op) || is_type(op)) + else if (is_type(op) || is_type(op) || + is_type(op) || is_type(op) || + is_type(op) || is_type(op)) { // Get the type of the second input, not the first // All BinaryElementwiseComparision ops have the same type for inputs @@ -186,7 +192,7 @@ bool runtime::interpreter::INTExecutable::call(const vectorget_type_name() <get_type_name() << std::endl; if (!op->evaluate(op_outputs, op_inputs)) { evaluate_node(op, op_outputs, op_inputs); @@ -335,24 +341,27 @@ vector> return result_tensors; } -bool -runtime::interpreter::INTExecutable::evaluate_node(const std::shared_ptr &node, const HostTensorVector &outputs, - const HostTensorVector &inputs) const { - auto & map = runtime::interpreter::get_evaluators_map(); +bool runtime::interpreter::INTExecutable::evaluate_node(const std::shared_ptr& node, + const HostTensorVector& outputs, + const HostTensorVector& inputs) const +{ + auto& map = runtime::interpreter::get_evaluators_map(); auto it = map.find(node->get_type_info()); bool res = false; if (it != map.end()) { res = it->second(node, outputs, inputs); - if (!res) { + if (!res) + { throw ngraph_error(std::string("Running evaluate method for OP ") + node->get_type_info().name + std::string(" failed!")); } } else { - throw unsupported_op(std::string("Interpreter backend doesn't implement evaluate method for OP ") + - node->get_type_info().name); + throw unsupported_op( + std::string("Interpreter backend doesn't implement evaluate method for OP ") + + node->get_type_info().name); } return res; } \ No newline at end of file diff --git a/ngraph/test/runtime/interpreter/int_executable.hpp b/ngraph/test/runtime/interpreter/int_executable.hpp index 53dde349bc5919..9285571b85fa07 100644 --- a/ngraph/test/runtime/interpreter/int_executable.hpp +++ b/ngraph/test/runtime/interpreter/int_executable.hpp @@ -71,8 +71,9 @@ class INTERPRETER_BACKEND_API ngraph::runtime::interpreter::INTExecutable : publ protected: std::shared_ptr get_parameter(size_t index) const; std::shared_ptr get_result(size_t index) const; - bool evaluate_node(const std::shared_ptr &node, const HostTensorVector &outputs, - const HostTensorVector &inputs) const; + bool evaluate_node(const std::shared_ptr& node, + const HostTensorVector& outputs, + const HostTensorVector& inputs) const; bool m_is_compiled = false; bool m_nan_check_enabled = false; bool m_performance_counters_enabled = false; diff --git a/ngraph/test/runtime/interpreter/opset_int_tbl.hpp b/ngraph/test/runtime/interpreter/opset_int_tbl.hpp index 79f8e09afdb5bf..9c2732d91e2390 100644 --- a/ngraph/test/runtime/interpreter/opset_int_tbl.hpp +++ b/ngraph/test/runtime/interpreter/opset_int_tbl.hpp @@ -14,7 +14,7 @@ // limitations under the License. //***************************************************************************** -#ifndef NGRAPH_OP +#ifndef NGRAPH_OP #warning "NGRAPH_OP not defined" #define NGRAPH_OP(x, y) #endif diff --git a/ngraph/test/runtime/interpreter/reference/elu.hpp b/ngraph/test/runtime/interpreter/reference/elu.hpp index 37410f01f9c9df..d04b4c3a88abdc 100644 --- a/ngraph/test/runtime/interpreter/reference/elu.hpp +++ b/ngraph/test/runtime/interpreter/reference/elu.hpp @@ -34,7 +34,5 @@ namespace ngraph } } } - - } } \ No newline at end of file diff --git a/ngraph/test/runtime/interpreter/reference/hard_sigmoid.hpp b/ngraph/test/runtime/interpreter/reference/hard_sigmoid.hpp index 577492fd17ffab..525fed729a1a06 100644 --- a/ngraph/test/runtime/interpreter/reference/hard_sigmoid.hpp +++ b/ngraph/test/runtime/interpreter/reference/hard_sigmoid.hpp @@ -32,7 +32,6 @@ namespace ngraph { namespace reference { - template void hard_sigmoid(const T* arg, const T* alpha, @@ -45,7 +44,10 @@ namespace ngraph int cnt = 0; for (size_t i = 0; i < size_arg; ++i) { - out[i] = std::max(T(0), std::min(T(1), T(alpha[cnt % size_alpha] * arg[i] + beta[cnt % size_beta]))); + out[i] = std::max( + T(0), + std::min(T(1), + T(alpha[cnt % size_alpha] * arg[i] + beta[cnt % size_beta]))); cnt++; } } diff --git a/ngraph/test/runtime/interpreter/reference/selu.hpp b/ngraph/test/runtime/interpreter/reference/selu.hpp index 2ae5b36d095c5e..c3642e148e2e2b 100644 --- a/ngraph/test/runtime/interpreter/reference/selu.hpp +++ b/ngraph/test/runtime/interpreter/reference/selu.hpp @@ -37,8 +37,9 @@ namespace ngraph int cnt = 0; for (size_t i = 0; i < size_arg; ++i) { - out[i] = arg[i] > T(0) ? T(lambda[cnt % size_lambda] * arg[i]) : - T(alpha[cnt % size_alpha] * lambda[cnt % size_lambda] * (std::exp(arg[i]) - 1)); + out[i] = arg[i] > T(0) ? T(lambda[cnt % size_lambda] * arg[i]) + : T(alpha[cnt % size_alpha] * lambda[cnt % size_lambda] * + (std::exp(arg[i]) - 1)); cnt++; } } diff --git a/ngraph/test/runtime/interpreter/reference/transpose.hpp b/ngraph/test/runtime/interpreter/reference/transpose.hpp index ff5567ab0dd95a..391dbdc50c25e9 100644 --- a/ngraph/test/runtime/interpreter/reference/transpose.hpp +++ b/ngraph/test/runtime/interpreter/reference/transpose.hpp @@ -33,25 +33,26 @@ namespace ngraph namespace reference { template - void transpose(const T* arg, - T* out, - Shape arg_size, - const U* axes_order = nullptr) + void transpose(const T* arg, T* out, Shape arg_size, const U* axes_order = nullptr) { - if (axes_order == nullptr) { + if (axes_order == nullptr) + { std::vector range_vector(arg_size.size()); size_t n = arg_size.size() - 1; - std::generate(range_vector.begin(), range_vector.end(), [&n](){ return n--; }); + std::generate(range_vector.begin(), range_vector.end(), [&n]() { return n--; }); axes_order = range_vector.data(); } size_t cnt = 0; - for(size_t i = 0; i < arg_size.size(); ++i) { + for (size_t i = 0; i < arg_size.size(); ++i) + { size_t axe = axes_order[i]; size_t start = 0; - for(size_t j = 0; j < axe; ++j) { + for (size_t j = 0; j < axe; ++j) + { start += shape_size(arg_size[j]); } - for (size_t j = start; j < start + shape_size(arg_size[axe]); ++j) { + for (size_t j = start; j < start + shape_size(arg_size[axe]); ++j) + { out[cnt++] = arg[j]; } } diff --git a/ngraph/test/runtime/pass/opset0_downgrade.cpp b/ngraph/test/runtime/pass/opset0_downgrade.cpp index 7ecc21b58c6883..efe46500c1c7a7 100644 --- a/ngraph/test/runtime/pass/opset0_downgrade.cpp +++ b/ngraph/test/runtime/pass/opset0_downgrade.cpp @@ -95,7 +95,6 @@ namespace // Default is that we did nothing shared_ptr op_cast(shared_ptr node) { return nullptr; } - shared_ptr op_cast(shared_ptr node) { auto const input_arg = node->input_value(0); diff --git a/ngraph/test/type_prop/convolution.cpp b/ngraph/test/type_prop/convolution.cpp index 55c27897ad5a1b..060916fffe1d1a 100644 --- a/ngraph/test/type_prop/convolution.cpp +++ b/ngraph/test/type_prop/convolution.cpp @@ -27,12 +27,8 @@ TEST(type_prop, conv_1d_deduce) // Deduce type auto param0 = make_shared(element::f32, Shape{64, 3, 100}); auto param1 = make_shared(element::f32, Shape{128, 3, 10}); - auto conv = make_shared(param0, - param1, - Strides{1}, - CoordinateDiff{0}, - CoordinateDiff{0}, - Strides{1}); + auto conv = make_shared( + param0, param1, Strides{1}, CoordinateDiff{0}, CoordinateDiff{0}, Strides{1}); EXPECT_EQ(conv->get_element_type(), element::f32); EXPECT_EQ(conv->get_shape(), (Shape{64, 128, 91})); @@ -47,8 +43,8 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) { // Deduce type Shape data_batch_shape{64, 3, 100}; - auto param0 = make_shared(element::f32, Shape{128, 3, 10}); // filters - auto param_filters = make_shared(element::f32, Shape{128, 3, 10}); // filters + auto param0 = make_shared(element::f32, Shape{128, 3, 10}); // filters + auto param_filters = make_shared(element::f32, Shape{128, 3, 10}); // filters auto param1 = make_shared(element::f32, Shape{64, 128, 91}); // output delta auto conv = make_shared(data_batch_shape, param0, @@ -69,7 +65,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) EXPECT_EQ(conv->get_padding_above_forward(), CoordinateDiff{0}); } // -//TEST(type_prop, conv_1d_deduce_padded) +// TEST(type_prop, conv_1d_deduce_padded) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{64, 3, 100}); @@ -91,7 +87,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above(), CoordinateDiff{3}); //} // -//TEST(type_prop, conv_1d_back_data_batch_deduce_padded) +// TEST(type_prop, conv_1d_back_data_batch_deduce_padded) //{ // // Deduce type // Shape data_batch_shape{64, 3, 100}; @@ -120,7 +116,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above_forward(), CoordinateDiff{3}); //} // -//TEST(type_prop, conv_1d_deduce_strided) +// TEST(type_prop, conv_1d_deduce_strided) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{64, 3, 100}); @@ -138,7 +134,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above(), CoordinateDiff{0}); //} // -//TEST(type_prop, conv_1d_back_data_batch_deduce_strided) +// TEST(type_prop, conv_1d_back_data_batch_deduce_strided) //{ // // Deduce type // Shape data_batch_shape{64, 3, 100}; @@ -164,7 +160,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above_forward(), CoordinateDiff{0}); //} // -//TEST(type_prop, conv_1d_deduce_strided_padded) +// TEST(type_prop, conv_1d_deduce_strided_padded) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{64, 3, 100}); @@ -186,7 +182,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above(), CoordinateDiff{3}); //} // -//TEST(type_prop, conv_1d_back_data_batch_deduce_strided_padded) +// TEST(type_prop, conv_1d_back_data_batch_deduce_strided_padded) //{ // // Deduce type // Shape data_batch_shape{64, 3, 100}; @@ -215,7 +211,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above_forward(), CoordinateDiff{3}); //} // -//TEST(type_prop, conv_1d_deduce_strided_small_uneven) +// TEST(type_prop, conv_1d_deduce_strided_small_uneven) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{64, 3, 5}); @@ -233,7 +229,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above(), CoordinateDiff{0}); //} // -//TEST(type_prop, conv_1d_back_data_batch_deduce_strided_small_uneven) +// TEST(type_prop, conv_1d_back_data_batch_deduce_strided_small_uneven) //{ // // Deduce type // Shape data_batch_shape{64, 3, 5}; @@ -259,7 +255,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above_forward(), CoordinateDiff{0}); //} // -//TEST(type_prop, conv_1d_deduce_strided_small_even) +// TEST(type_prop, conv_1d_deduce_strided_small_even) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{64, 3, 6}); @@ -277,7 +273,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above(), CoordinateDiff{0}); //} // -//TEST(type_prop, conv_1d_back_data_batch_deduce_strided_small_even) +// TEST(type_prop, conv_1d_back_data_batch_deduce_strided_small_even) //{ // // Deduce type // Shape data_batch_shape{64, 3, 6}; @@ -303,7 +299,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above_forward(), CoordinateDiff{0}); //} // -//TEST(type_prop, conv_1d_deduce_window_dilated) +// TEST(type_prop, conv_1d_deduce_window_dilated) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{64, 3, 100}); @@ -322,7 +318,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above(), CoordinateDiff{0}); //} // -//TEST(type_prop, conv_1d_back_data_batch_deduce_window_dilated) +// TEST(type_prop, conv_1d_back_data_batch_deduce_window_dilated) //{ // // Deduce type // Shape data_batch_shape{64, 3, 100}; @@ -349,7 +345,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above_forward(), CoordinateDiff{0}); //} // -//TEST(type_prop, conv_1d_deduce_window_dilated_padded) +// TEST(type_prop, conv_1d_deduce_window_dilated_padded) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{64, 3, 100}); @@ -371,7 +367,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above(), CoordinateDiff{3}); //} // -//TEST(type_prop, conv_1d_back_data_batch_deduce_window_dilated_padded) +// TEST(type_prop, conv_1d_back_data_batch_deduce_window_dilated_padded) //{ // // Deduce type // Shape data_batch_shape{64, 3, 100}; @@ -400,7 +396,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above_forward(), CoordinateDiff{3}); //} // -//TEST(type_prop, conv_1d_deduce_window_dilated_data_dilated_padded) +// TEST(type_prop, conv_1d_deduce_window_dilated_data_dilated_padded) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{64, 3, 100}); @@ -428,7 +424,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above(), CoordinateDiff{3}); //} // -//TEST(type_prop, conv_1d_back_data_batch_deduce_window_dilated_data_dilated_padded) +// TEST(type_prop, conv_1d_back_data_batch_deduce_window_dilated_data_dilated_padded) //{ // // Deduce type // Shape data_batch_shape{64, 3, 100}; @@ -458,7 +454,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above_forward(), CoordinateDiff{3}); //} // -//TEST(type_prop, conv_2d_deduce) +// TEST(type_prop, conv_2d_deduce) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{64, 3, 100, 150}); @@ -475,7 +471,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above(), (CoordinateDiff{0, 0})); //} // -//TEST(type_prop, conv_2d_deduce_padded) +// TEST(type_prop, conv_2d_deduce_padded) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{64, 3, 100, 150}); @@ -497,7 +493,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above(), (CoordinateDiff{3, 4})); //} // -//TEST(type_prop, conv_2d_deduce_padded_neg) +// TEST(type_prop, conv_2d_deduce_padded_neg) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{64, 3, 100, 150}); @@ -519,13 +515,13 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above(), (CoordinateDiff{3, -4})); //} // -//struct DeduceAutoPadTest +// struct DeduceAutoPadTest // : ::testing::TestWithParam< // std::tuple> //{ //}; // -//TEST_P(DeduceAutoPadTest, same_lower) +// TEST_P(DeduceAutoPadTest, same_lower) //{ // auto image_shape = std::get<0>(GetParam()); // image_shape.insert(image_shape.begin(), {1, 1}); // Add {N, C} @@ -546,7 +542,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_below(), std::get<5>(GetParam())); //} // -//INSTANTIATE_TEST_CASE_P(type_prop, +// INSTANTIATE_TEST_CASE_P(type_prop, // DeduceAutoPadTest, // ::testing::Values(std::make_tuple(Shape{5, 6}, // Shape{3, 4}, @@ -591,7 +587,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // CoordinateDiff{2, 1, 1}, // CoordinateDiff{2, 1, 2})), ); // -//TEST(type_prop, conv_2d_deduce_strided) +// TEST(type_prop, conv_2d_deduce_strided) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{64, 3, 100, 150}); @@ -609,7 +605,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above(), (CoordinateDiff{0, 0})); //} // -//TEST(type_prop, conv_2d_deduce_strided_window_dilated) +// TEST(type_prop, conv_2d_deduce_strided_window_dilated) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{64, 3, 100, 150}); @@ -628,7 +624,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above(), (CoordinateDiff{0, 0})); //} // -//TEST(type_prop, conv_2d_deduce_strided_window_dilated_data_dilated) +// TEST(type_prop, conv_2d_deduce_strided_window_dilated_data_dilated) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{64, 3, 100, 150}); @@ -656,7 +652,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above(), (CoordinateDiff{0, 0})); //} // -//TEST(type_prop, conv_2d_deduce_strided_window_dilated_small) +// TEST(type_prop, conv_2d_deduce_strided_window_dilated_small) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{64, 3, 7, 8}); @@ -675,7 +671,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above(), (CoordinateDiff{0, 0})); //} // -//TEST(type_prop, conv_3d_deduce_strided_window_dilated_small) +// TEST(type_prop, conv_3d_deduce_strided_window_dilated_small) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{64, 3, 7, 8, 10}); @@ -694,7 +690,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above(), (CoordinateDiff{0, 0, 0})); //} // -//TEST(type_prop, conv_3d_deduce_strided_window_dilated_data_dilated_small) +// TEST(type_prop, conv_3d_deduce_strided_window_dilated_data_dilated_small) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{64, 3, 7, 8, 10}); @@ -722,7 +718,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_EQ(conv->get_padding_above(), (CoordinateDiff{0, 0, 0})); //} // -//TEST(type_prop, conv_invalid_element_type_mismatch) +// TEST(type_prop, conv_invalid_element_type_mismatch) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{3, 3, 3, 3}); @@ -737,7 +733,8 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // catch (const NodeValidationFailure& error) // { // EXPECT_HAS_SUBSTRING(error.what(), -// std::string("Element types for data batch and filters do not match")); +// std::string("Element types for data batch and filters do not +// match")); // } // catch (...) // { @@ -745,7 +742,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_invalid_0d_input) +// TEST(type_prop, conv_invalid_0d_input) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{}); @@ -770,7 +767,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_invalid_1d_input) +// TEST(type_prop, conv_invalid_1d_input) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{2}); @@ -795,7 +792,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_invalid_2d_input) +// TEST(type_prop, conv_invalid_2d_input) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{2, 6}); @@ -820,7 +817,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_invalid_0_batch_size) +// TEST(type_prop, conv_invalid_0_batch_size) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{0, 6, 1}); @@ -842,7 +839,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_invalid_0_input_channels) +// TEST(type_prop, conv_invalid_0_input_channels) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{6, 0, 1}); @@ -866,7 +863,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_invalid_wrong_number_of_filter_dimensions_too_many) +// TEST(type_prop, conv_invalid_wrong_number_of_filter_dimensions_too_many) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{6, 2, 10, 10}); @@ -880,7 +877,8 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } // catch (const NodeValidationFailure& error) // { -// EXPECT_HAS_SUBSTRING(error.what(), std::string("Data batch and filters rank do not match")); +// EXPECT_HAS_SUBSTRING(error.what(), std::string("Data batch and filters rank do not +// match")); // } // catch (...) // { @@ -888,7 +886,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_invalid_wrong_number_of_filter_dimensions_too_few) +// TEST(type_prop, conv_invalid_wrong_number_of_filter_dimensions_too_few) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{6, 2, 10, 10}); @@ -902,7 +900,8 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } // catch (const NodeValidationFailure& error) // { -// EXPECT_HAS_SUBSTRING(error.what(), std::string("Data batch and filters rank do not match")); +// EXPECT_HAS_SUBSTRING(error.what(), std::string("Data batch and filters rank do not +// match")); // } // catch (...) // { @@ -910,7 +909,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_invalid_0_output_channels) +// TEST(type_prop, conv_invalid_0_output_channels) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{6, 2, 10, 10}); @@ -932,7 +931,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_invalid_input_channel_mismatch) +// TEST(type_prop, conv_invalid_input_channel_mismatch) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{6, 2, 10, 10}); @@ -957,7 +956,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_invalid_movement_stride_rank) +// TEST(type_prop, conv_invalid_movement_stride_rank) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{6, 2, 10, 10}); @@ -974,8 +973,10 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_HAS_SUBSTRING( // error.what(), // std::string("Ranks for data item shape/filters shape (data batch has shape " -// "{6,2,10,10}, so data item rank is 2 and filters have shape {6,2,3,3}, so " -// "filters spatial rank is 2), data dilation (Strides{1, 1}), padding below " +// "{6,2,10,10}, so data item rank is 2 and filters have shape {6,2,3,3}, so +// " +// "filters spatial rank is 2), data dilation (Strides{1, 1}), padding below +// " // "(CoordinateDiff{0, 0}), padding above (CoordinateDiff{0, 0}), filter " // "strides (Strides{2, 3, 8}), and filter dilation (Strides{1, 1}) do not " // "match")); @@ -986,7 +987,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_invalid_window_dilation_stride_rank) +// TEST(type_prop, conv_invalid_window_dilation_stride_rank) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{6, 2, 10, 10}); @@ -1004,8 +1005,10 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_HAS_SUBSTRING( // error.what(), // std::string("Ranks for data item shape/filters shape (data batch has shape " -// "{6,2,10,10}, so data item rank is 2 and filters have shape {6,2,3,3}, so " -// "filters spatial rank is 2), data dilation (Strides{1, 1}), padding below " +// "{6,2,10,10}, so data item rank is 2 and filters have shape {6,2,3,3}, so +// " +// "filters spatial rank is 2), data dilation (Strides{1, 1}), padding below +// " // "(CoordinateDiff{0, 0}), padding above (CoordinateDiff{0, 0}), filter " // "strides (Strides{2, 3}), and filter dilation (Strides{2, 3, 8}) do not " // "match")); @@ -1016,7 +1019,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_invalid_data_dilation_stride_rank) +// TEST(type_prop, conv_invalid_data_dilation_stride_rank) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{6, 2, 10, 10}); @@ -1039,7 +1042,8 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_HAS_SUBSTRING( // error.what(), // std::string("Ranks for data item shape/filters shape (data batch has shape " -// "{6,2,10,10}, so data item rank is 2 and filters have shape {6,2,3,3}, so " +// "{6,2,10,10}, so data item rank is 2 and filters have shape {6,2,3,3}, so +// " // "filters spatial rank is 2), data dilation (Strides{2, 3, 8}), padding " // "below (CoordinateDiff{0, 0}), padding above (CoordinateDiff{0, 0}), " // "filter strides (Strides{2, 3}), and filter dilation (Strides{2, 3}) do " @@ -1051,7 +1055,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_invalid_padding_below_rank) +// TEST(type_prop, conv_invalid_padding_below_rank) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{6, 2, 10, 10}); @@ -1085,7 +1089,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_invalid_padding_above_rank) +// TEST(type_prop, conv_invalid_padding_above_rank) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{6, 2, 10, 10}); @@ -1119,7 +1123,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_invalid_input_spatial_size_negative_after_padding) +// TEST(type_prop, conv_invalid_input_spatial_size_negative_after_padding) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{6, 2, 10, 10}); @@ -1139,7 +1143,8 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // catch (const NodeValidationFailure& error) // { // EXPECT_HAS_SUBSTRING(error.what(), -// std::string("Data shape after padding and dilation has dimension less " +// std::string("Data shape after padding and dilation has dimension less +// " // "than 1 (dim: -1) at axis 0")); // } // catch (...) @@ -1148,7 +1153,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_invalid_input_spatial_size_zero_after_padding) +// TEST(type_prop, conv_invalid_input_spatial_size_zero_after_padding) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{6, 2, 10, 10}); @@ -1168,7 +1173,8 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // catch (const NodeValidationFailure& error) // { // EXPECT_HAS_SUBSTRING(error.what(), -// std::string("Data shape after padding and dilation has dimension less " +// std::string("Data shape after padding and dilation has dimension less +// " // "than 1 (dim: 0) at axis 0")); // } // catch (...) @@ -1177,7 +1183,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_invalid_input_spatial_size_0) +// TEST(type_prop, conv_invalid_input_spatial_size_0) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{6, 2, 0, 10}); @@ -1201,7 +1207,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_invalid_window_size_0) +// TEST(type_prop, conv_invalid_window_size_0) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{6, 2, 10, 10}); @@ -1225,14 +1231,15 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_invalid_window_dilation_stride_0) +// TEST(type_prop, conv_invalid_window_dilation_stride_0) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{6, 2, 10, 10}); // auto param1 = make_shared(element::f32, Shape{6, 2, 3, 3}); // try // { -// auto conv = make_shared(param0, param1, Strides{2, 3}, Strides{2, 0}); +// auto conv = make_shared(param0, param1, Strides{2, 3}, Strides{2, +// 0}); // // // Should have thrown, so fail if it didn't // FAIL() << "Invalid input with wrong 0-length window dilation stride axis not detected"; @@ -1249,7 +1256,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_invalid_data_dilation_stride_0) +// TEST(type_prop, conv_invalid_data_dilation_stride_0) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{6, 2, 10, 10}); @@ -1279,14 +1286,15 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_invalid_dilated_window_too_large) +// TEST(type_prop, conv_invalid_dilated_window_too_large) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{6, 2, 8, 8}); // auto param1 = make_shared(element::f32, Shape{6, 2, 3, 3}); // try // { -// auto conv = make_shared(param0, param1, Strides{1, 1}, Strides{4, 4}); +// auto conv = make_shared(param0, param1, Strides{1, 1}, Strides{4, +// 4}); // // // Should have thrown, so fail if it didn't // FAIL() << "Invalid input with oversized dilated window not detected"; @@ -1294,7 +1302,8 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // catch (const NodeValidationFailure& error) // { // EXPECT_HAS_SUBSTRING(error.what(), -// std::string("Window after dilation has dimension (dim: 9) larger than " +// std::string("Window after dilation has dimension (dim: 9) larger than +// " // "the data shape after padding (dim: 8) at axis 0")); // } // catch (...) @@ -1303,7 +1312,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_invalid_movement_stride_0) +// TEST(type_prop, conv_invalid_movement_stride_0) //{ // // Deduce type // auto param0 = make_shared(element::f32, Shape{6, 2, 10, 10}); @@ -1327,7 +1336,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_partial_rank_dynamic_rank_dynamic_ok) +// TEST(type_prop, conv_partial_rank_dynamic_rank_dynamic_ok) //{ // PartialShape data_batch_shape{PartialShape::dynamic()}; // PartialShape filters_shape{PartialShape::dynamic()}; @@ -1352,7 +1361,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // ASSERT_TRUE(conv->get_output_partial_shape(0).same_scheme(PartialShape::dynamic(4))); //} // -//TEST(type_prop, conv_partial_rank_dynamic_rank_dynamic_window_strides_rank_wrong) +// TEST(type_prop, conv_partial_rank_dynamic_rank_dynamic_window_strides_rank_wrong) //{ // PartialShape data_batch_shape{PartialShape::dynamic()}; // PartialShape filters_shape{PartialShape::dynamic()}; @@ -1381,10 +1390,12 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // { // EXPECT_HAS_SUBSTRING( // error.what(), -// std::string("Ranks for data item shape/filters shape (data batch has shape ?, so data " +// std::string("Ranks for data item shape/filters shape (data batch has shape ?, so data +// " // "item rank is ? and filters have shape ?, so filters spatial rank is ?), " // "data dilation (Strides{1, 1}), padding below (CoordinateDiff{0, 0}), " -// "padding above (CoordinateDiff{0, 0}), filter strides (Strides{1, 1, 1}), " +// "padding above (CoordinateDiff{0, 0}), filter strides (Strides{1, 1, 1}), +// " // "and filter dilation (Strides{1, 1}) do not match")); // } // catch (...) @@ -1393,7 +1404,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_partial_rank_dynamic_rank_dynamic_window_strides_dim_zero) +// TEST(type_prop, conv_partial_rank_dynamic_rank_dynamic_window_strides_dim_zero) //{ // PartialShape data_batch_shape{PartialShape::dynamic()}; // PartialShape filters_shape{PartialShape::dynamic()}; @@ -1430,7 +1441,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_partial_rank_dynamic_rank_dynamic_window_dilation_rank_wrong) +// TEST(type_prop, conv_partial_rank_dynamic_rank_dynamic_window_dilation_rank_wrong) //{ // PartialShape data_batch_shape{PartialShape::dynamic()}; // PartialShape filters_shape{PartialShape::dynamic()}; @@ -1459,10 +1470,12 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // { // EXPECT_HAS_SUBSTRING( // error.what(), -// std::string("Ranks for data item shape/filters shape (data batch has shape ?, so data " +// std::string("Ranks for data item shape/filters shape (data batch has shape ?, so data +// " // "item rank is ? and filters have shape ?, so filters spatial rank is ?), " // "data dilation (Strides{1, 1}), padding below (CoordinateDiff{0, 0}), " -// "padding above (CoordinateDiff{0, 0}), filter strides (Strides{1, 1}), and " +// "padding above (CoordinateDiff{0, 0}), filter strides (Strides{1, 1}), and +// " // "filter dilation (Strides{1, 1, 1}) do not match")); // } // catch (...) @@ -1471,7 +1484,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_partial_rank_dynamic_rank_dynamic_window_dilation_dim_zero) +// TEST(type_prop, conv_partial_rank_dynamic_rank_dynamic_window_dilation_dim_zero) //{ // PartialShape data_batch_shape{PartialShape::dynamic()}; // PartialShape filters_shape{PartialShape::dynamic()}; @@ -1508,7 +1521,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_partial_rank_dynamic_rank_dynamic_padding_below_rank_wrong) +// TEST(type_prop, conv_partial_rank_dynamic_rank_dynamic_padding_below_rank_wrong) //{ // PartialShape data_batch_shape{PartialShape::dynamic()}; // PartialShape filters_shape{PartialShape::dynamic()}; @@ -1537,10 +1550,12 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // { // EXPECT_HAS_SUBSTRING( // error.what(), -// std::string("Ranks for data item shape/filters shape (data batch has shape ?, so data " +// std::string("Ranks for data item shape/filters shape (data batch has shape ?, so data +// " // "item rank is ? and filters have shape ?, so filters spatial rank is ?), " // "data dilation (Strides{1, 1}), padding below (CoordinateDiff{0, 0, 0}), " -// "padding above (CoordinateDiff{0, 0}), filter strides (Strides{1, 1}), and " +// "padding above (CoordinateDiff{0, 0}), filter strides (Strides{1, 1}), and +// " // "filter dilation (Strides{1, 1}) do not match")); // } // catch (...) @@ -1549,7 +1564,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_partial_rank_dynamic_rank_dynamic_padding_above_rank_wrong) +// TEST(type_prop, conv_partial_rank_dynamic_rank_dynamic_padding_above_rank_wrong) //{ // PartialShape data_batch_shape{PartialShape::dynamic()}; // PartialShape filters_shape{PartialShape::dynamic()}; @@ -1578,10 +1593,12 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // { // EXPECT_HAS_SUBSTRING( // error.what(), -// std::string("Ranks for data item shape/filters shape (data batch has shape ?, so data " +// std::string("Ranks for data item shape/filters shape (data batch has shape ?, so data +// " // "item rank is ? and filters have shape ?, so filters spatial rank is ?), " // "data dilation (Strides{1, 1}), padding below (CoordinateDiff{0, 0}), " -// "padding above (CoordinateDiff{0, 0, 0}), filter strides (Strides{1, 1}), " +// "padding above (CoordinateDiff{0, 0, 0}), filter strides (Strides{1, 1}), +// " // "and filter dilation (Strides{1, 1}) do not match")); // } // catch (...) @@ -1590,7 +1607,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_partial_rank_dynamic_rank_dynamic_data_dilation_rank_wrong) +// TEST(type_prop, conv_partial_rank_dynamic_rank_dynamic_data_dilation_rank_wrong) //{ // PartialShape data_batch_shape{PartialShape::dynamic()}; // PartialShape filters_shape{PartialShape::dynamic()}; @@ -1619,10 +1636,12 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // { // EXPECT_HAS_SUBSTRING( // error.what(), -// std::string("Ranks for data item shape/filters shape (data batch has shape ?, so data " +// std::string("Ranks for data item shape/filters shape (data batch has shape ?, so data +// " // "item rank is ? and filters have shape ?, so filters spatial rank is ?), " // "data dilation (Strides{1, 1, 1}), padding below (CoordinateDiff{0, 0}), " -// "padding above (CoordinateDiff{0, 0}), filter strides (Strides{1, 1}), and " +// "padding above (CoordinateDiff{0, 0}), filter strides (Strides{1, 1}), and +// " // "filter dilation (Strides{1, 1}) do not match")); // } // catch (...) @@ -1631,7 +1650,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_partial_rank_dynamic_rank_dynamic_data_dilation_dim_zero) +// TEST(type_prop, conv_partial_rank_dynamic_rank_dynamic_data_dilation_dim_zero) //{ // PartialShape data_batch_shape{PartialShape::dynamic()}; // PartialShape filters_shape{PartialShape::dynamic()}; @@ -1668,7 +1687,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_partial_rank_static_dynamic_rank_dynamic_ok) +// TEST(type_prop, conv_partial_rank_static_dynamic_rank_dynamic_ok) //{ // PartialShape data_batch_shape{PartialShape::dynamic(4)}; // PartialShape filters_shape{PartialShape::dynamic()}; @@ -1693,7 +1712,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // ASSERT_TRUE(conv->get_output_partial_shape(0).same_scheme(PartialShape::dynamic(4))); //} // -//TEST(type_prop, conv_partial_rank_static_dynamic_rank_dynamic_data_batch_rank_wrong) +// TEST(type_prop, conv_partial_rank_static_dynamic_rank_dynamic_data_batch_rank_wrong) //{ // PartialShape data_batch_shape{PartialShape::dynamic(5)}; // PartialShape filters_shape{PartialShape::dynamic()}; @@ -1723,7 +1742,8 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // EXPECT_HAS_SUBSTRING( // error.what(), // std::string("Ranks for data item shape/filters shape (data batch has shape " -// "{?,?,?,?,?}, so data item rank is 3 and filters have shape ?, so filters " +// "{?,?,?,?,?}, so data item rank is 3 and filters have shape ?, so filters +// " // "spatial rank is ?), data dilation (Strides{1, 1}), padding below " // "(CoordinateDiff{0, 0}), padding above (CoordinateDiff{0, 0}), filter " // "strides (Strides{1, 1}), and filter dilation (Strides{1, 1}) do not " @@ -1735,7 +1755,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_partial_rank_static_dynamic_rank_dynamic_batch_size_known_ok) +// TEST(type_prop, conv_partial_rank_static_dynamic_rank_dynamic_batch_size_known_ok) //{ // PartialShape data_batch_shape{ // 64, Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic()}; @@ -1762,7 +1782,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // PartialShape{64, Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic()})); //} // -//TEST(type_prop, conv_partial_rank_static_dynamic_rank_dynamic_batch_size_known_zero) +// TEST(type_prop, conv_partial_rank_static_dynamic_rank_dynamic_batch_size_known_zero) //{ // PartialShape data_batch_shape{ // 0, Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic()}; @@ -1798,7 +1818,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_partial_rank_static_dynamic_rank_dynamic_input_channel_count_known_ok) +// TEST(type_prop, conv_partial_rank_static_dynamic_rank_dynamic_input_channel_count_known_ok) //{ // PartialShape data_batch_shape{ // Dimension::dynamic(), 3, Dimension::dynamic(), Dimension::dynamic()}; @@ -1824,7 +1844,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // ASSERT_TRUE(conv->get_output_partial_shape(0).same_scheme(PartialShape::dynamic(4))); //} // -//TEST(type_prop, conv_partial_rank_static_dynamic_rank_dynamic_input_channel_count_known_zero) +// TEST(type_prop, conv_partial_rank_static_dynamic_rank_dynamic_input_channel_count_known_zero) //{ // PartialShape data_batch_shape{ // Dimension::dynamic(), 0, Dimension::dynamic(), Dimension::dynamic()}; @@ -1862,7 +1882,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_partial_rank_dynamic_rank_static_dynamic_output_channel_count_known_ok) +// TEST(type_prop, conv_partial_rank_dynamic_rank_static_dynamic_output_channel_count_known_ok) //{ // PartialShape data_batch_shape{PartialShape::dynamic(4)}; // PartialShape filters_shape{ @@ -1889,10 +1909,11 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // PartialShape{Dimension::dynamic(), 32, Dimension::dynamic(), Dimension::dynamic()})); //} // -//TEST(type_prop, conv_partial_rank_dynamic_rank_static_dynamic_output_channel_count_known_zero) +// TEST(type_prop, conv_partial_rank_dynamic_rank_static_dynamic_output_channel_count_known_zero) //{ // PartialShape data_batch_shape{PartialShape::dynamic(4)}; -// PartialShape filters_shape{0, Dimension::dynamic(), Dimension::dynamic(), Dimension::dynamic()}; +// PartialShape filters_shape{0, Dimension::dynamic(), Dimension::dynamic(), +// Dimension::dynamic()}; // Strides window_movement_strides{1, 1}; // Strides window_dilation_strides{1, 1}; // CoordinateDiff padding_below{0, 0}; @@ -1924,10 +1945,11 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_partial_rank_dynamic_rank_static_dynamic_input_channel_count_known_ok) +// TEST(type_prop, conv_partial_rank_dynamic_rank_static_dynamic_input_channel_count_known_ok) //{ // PartialShape data_batch_shape{PartialShape::dynamic(4)}; -// PartialShape filters_shape{Dimension::dynamic(), 4, Dimension::dynamic(), Dimension::dynamic()}; +// PartialShape filters_shape{Dimension::dynamic(), 4, Dimension::dynamic(), +// Dimension::dynamic()}; // Strides window_movement_strides{1, 1}; // Strides window_dilation_strides{1, 1}; // CoordinateDiff padding_below{0, 0}; @@ -1949,10 +1971,11 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // ASSERT_TRUE(conv->get_output_partial_shape(0).same_scheme(PartialShape::dynamic(4))); //} // -//TEST(type_prop, conv_partial_rank_dynamic_rank_static_dynamic_input_channel_count_known_zero) +// TEST(type_prop, conv_partial_rank_dynamic_rank_static_dynamic_input_channel_count_known_zero) //{ // PartialShape data_batch_shape{PartialShape::dynamic(4)}; -// PartialShape filters_shape{Dimension::dynamic(), 0, Dimension::dynamic(), Dimension::dynamic()}; +// PartialShape filters_shape{Dimension::dynamic(), 0, Dimension::dynamic(), +// Dimension::dynamic()}; // Strides window_movement_strides{1, 1}; // Strides window_dilation_strides{1, 1}; // CoordinateDiff padding_below{0, 0}; @@ -1986,7 +2009,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_partial_rank_static_dynamic_rank_static_dynamic_ok) +// TEST(type_prop, conv_partial_rank_static_dynamic_rank_static_dynamic_ok) //{ // PartialShape data_batch_shape{PartialShape::dynamic(4)}; // PartialShape filters_shape{PartialShape::dynamic(4)}; @@ -2011,7 +2034,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // ASSERT_TRUE(conv->get_output_partial_shape(0).same_scheme(PartialShape::dynamic(4))); //} // -//TEST(type_prop, conv_partial_rank_static_dynamic_rank_static_dynamic_arg_ranks_mismatch) +// TEST(type_prop, conv_partial_rank_static_dynamic_rank_static_dynamic_arg_ranks_mismatch) //{ // PartialShape data_batch_shape{PartialShape::dynamic(5)}; // PartialShape filters_shape{PartialShape::dynamic(4)}; @@ -2048,11 +2071,13 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_partial_rank_static_dynamic_rank_static_dynamic_input_channel_counts_known_ok) +// TEST(type_prop, +// conv_partial_rank_static_dynamic_rank_static_dynamic_input_channel_counts_known_ok) //{ // PartialShape data_batch_shape{ // Dimension::dynamic(), 3, Dimension::dynamic(), Dimension::dynamic()}; -// PartialShape filters_shape{Dimension::dynamic(), 3, Dimension::dynamic(), Dimension::dynamic()}; +// PartialShape filters_shape{Dimension::dynamic(), 3, Dimension::dynamic(), +// Dimension::dynamic()}; // Strides window_movement_strides{1, 1}; // Strides window_dilation_strides{1, 1}; // CoordinateDiff padding_below{0, 0}; @@ -2074,7 +2099,8 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // ASSERT_TRUE(conv->get_output_partial_shape(0).same_scheme(PartialShape::dynamic(4))); //} // -//TEST(type_prop, conv_partial_rank_static_dynamic_rank_static_dynamic_input_channel_counts_mismatch) +// TEST(type_prop, +// conv_partial_rank_static_dynamic_rank_static_dynamic_input_channel_counts_mismatch) //{ // PartialShape data_batch_shape{ // Dimension::dynamic(), 3, Dimension::dynamic(), Dimension::dynamic()}; @@ -2114,7 +2140,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_partial_rank_static_dynamic_rank_static_dynamic_all_nonspatial_known_ok) +// TEST(type_prop, conv_partial_rank_static_dynamic_rank_static_dynamic_all_nonspatial_known_ok) //{ // PartialShape data_batch_shape{64, 3, Dimension::dynamic(), Dimension::dynamic()}; // PartialShape filters_shape{100, 3, Dimension::dynamic(), Dimension::dynamic()}; @@ -2140,7 +2166,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // PartialShape{64, 100, Dimension::dynamic(), Dimension::dynamic()})); //} // -//TEST(type_prop, +// TEST(type_prop, // conv_partial_rank_static_dynamic_rank_static_dynamic_all_nonspatial_some_spatial_known_ok) //{ // PartialShape data_batch_shape{64, 3, 200, Dimension::dynamic()}; @@ -2167,7 +2193,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // PartialShape{64, 100, 196, Dimension::dynamic()})); //} // -//TEST( +// TEST( // type_prop, // conv_partial_rank_static_dynamic_rank_static_dynamic_all_nonspatial_some_spatial_known_filters_too_big) //{ @@ -2198,7 +2224,8 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // { // EXPECT_HAS_SUBSTRING(error.what(), // std::string("Window after dilation has dimension (dim: 201) larger " -// "than the data shape after padding (dim: 200) at axis 0")); +// "than the data shape after padding (dim: 200) at axis +// 0")); // } // catch (...) // { @@ -2206,7 +2233,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST( +// TEST( // type_prop, // conv_partial_rank_static_dynamic_rank_static_dynamic_all_nonspatial_some_spatial_known_filters_not_too_big_after_padding) //{ @@ -2234,7 +2261,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // PartialShape{64, 100, 1, Dimension::dynamic()})); //} // -//TEST( +// TEST( // type_prop, // conv_partial_rank_static_dynamic_rank_static_dynamic_all_nonspatial_some_spatial_known_filters_not_too_big_after_data_dilation) //{ @@ -2262,7 +2289,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // PartialShape{64, 100, 199, Dimension::dynamic()})); //} // -//TEST( +// TEST( // type_prop, // conv_partial_rank_static_dynamic_rank_static_dynamic_all_nonspatial_some_spatial_known_filters_not_too_big_after_data_dilation_strided) //{ @@ -2290,7 +2317,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // PartialShape{64, 100, 67, Dimension::dynamic()})); //} // -//TEST( +// TEST( // type_prop, // conv_partial_rank_static_dynamic_rank_static_dynamic_all_nonspatial_some_spatial_known_filters_too_big_after_filter_dilation) //{ @@ -2321,7 +2348,8 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // { // EXPECT_HAS_SUBSTRING(error.what(), // std::string("Window after dilation has dimension (dim: 201) larger " -// "than the data shape after padding (dim: 200) at axis 0")); +// "than the data shape after padding (dim: 200) at axis +// 0")); // } // catch (...) // { @@ -2329,7 +2357,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST( +// TEST( // type_prop, // conv_partial_rank_static_dynamic_rank_static_dynamic_all_nonspatial_some_spatial_zero_data_batch_dim) //{ @@ -2368,7 +2396,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST( +// TEST( // type_prop, // conv_partial_rank_static_dynamic_rank_static_dynamic_all_nonspatial_some_spatial_positive_data_batch_dim_after_padding) //{ @@ -2396,7 +2424,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // PartialShape{64, 100, 196, Dimension::dynamic()})); //} // -//TEST( +// TEST( // type_prop, // conv_partial_rank_static_dynamic_rank_static_dynamic_all_nonspatial_some_spatial_zero_data_batch_dim_after_padding) //{ @@ -2435,7 +2463,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST( +// TEST( // type_prop, // conv_partial_rank_static_dynamic_rank_static_dynamic_all_nonspatial_some_spatial_negative_data_batch_dim_after_padding) //{ @@ -2465,7 +2493,8 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // catch (const NodeValidationFailure& error) // { // EXPECT_HAS_SUBSTRING(error.what(), -// std::string("Data shape after padding and dilation has dimension less " +// std::string("Data shape after padding and dilation has dimension less +// " // "than 1 (dim: -1) at axis 1")); // } // catch (...) @@ -2474,7 +2503,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, conv_partial_dynamic_et) +// TEST(type_prop, conv_partial_dynamic_et) //{ // // For this test the exact shape parameters are kind of arbitrary---just copied and pasted // // from some known-"OK" test above. We're only concerned about the element types. @@ -2502,7 +2531,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // PartialShape{64, 100, 1, Dimension::dynamic()})); //} // -//TEST(type_prop, conv_bprop_data_v1_output_partial_shape_dynamic) +// TEST(type_prop, conv_bprop_data_v1_output_partial_shape_dynamic) //{ // Shape shape_filter{6, 3, 3, 3}; // auto filters = make_shared(element::f32, shape_filter); @@ -2521,7 +2550,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // ASSERT_TRUE(conv1->get_output_partial_shape(0).is_dynamic()); //} // -//TEST(type_prop, conv_bprop_data_v1_output_partial_shape_dynamic_static_rank) +// TEST(type_prop, conv_bprop_data_v1_output_partial_shape_dynamic_static_rank) //{ // PartialShape shape_filter{20, 10, 3, 3}; // auto filters = make_shared(element::f32, shape_filter); @@ -2542,7 +2571,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // PartialShape{Dimension::dynamic(), 10, 447, 447})); //} // -//TEST(type_prop, conv_v1_partial_rank) +// TEST(type_prop, conv_v1_partial_rank) //{ // PartialShape data_batch_shape{PartialShape::dynamic()}; // PartialShape filters_shape{PartialShape::dynamic()}; @@ -2564,7 +2593,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // ASSERT_TRUE(conv->get_output_partial_shape(0).is_dynamic()); //} // -//TEST(type_prop, conv_v1_partial_auto_padding_same) +// TEST(type_prop, conv_v1_partial_auto_padding_same) //{ // const PartialShape data_batch_shape{1, 1, 5, 5}; // const PartialShape filters_shape{1, 1, 3, 3}; @@ -2585,7 +2614,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // ASSERT_EQ(conv->get_pads_end(), (CoordinateDiff{1, 1})); //} // -//TEST(type_prop, conv_v1_partial_auto_padding_same_nc_dims_dynamic_same_lower) +// TEST(type_prop, conv_v1_partial_auto_padding_same_nc_dims_dynamic_same_lower) //{ // const PartialShape data_batch_shape{Dimension::dynamic(), Dimension::dynamic(), 5, 5}; // const PartialShape filters_shape{1, 1, 3, 3}; @@ -2606,7 +2635,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // ASSERT_EQ(conv->get_pads_end(), (CoordinateDiff{1, 1})); //} // -//TEST(type_prop, conv_v1_partial_auto_padding_same_nc_dims_dynamic_same_upper) +// TEST(type_prop, conv_v1_partial_auto_padding_same_nc_dims_dynamic_same_upper) //{ // const PartialShape data_batch_shape{Dimension::dynamic(), Dimension::dynamic(), 5, 5}; // const PartialShape filters_shape{1, 1, 2, 2}; @@ -2627,7 +2656,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // ASSERT_EQ(conv->get_pads_end(), (CoordinateDiff{1, 1})); //} // -//TEST(type_prop, conv_v1_partial_auto_padding_same_spatial_dims_dynamic) +// TEST(type_prop, conv_v1_partial_auto_padding_same_spatial_dims_dynamic) //{ // const PartialShape data_batch_shape{1, 1, Dimension::dynamic(), 5}; // const PartialShape filters_shape{1, 1, 3, 3}; @@ -2649,7 +2678,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // ASSERT_EQ(conv->get_pads_end(), (CoordinateDiff{})); //} // -//TEST(type_prop, conv_v1_partial_data_shape_dynamic) +// TEST(type_prop, conv_v1_partial_data_shape_dynamic) //{ // const PartialShape data_batch_shape{PartialShape::dynamic()}; // const PartialShape filters_shape{1, 1, 3, 3}; @@ -2670,7 +2699,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // ASSERT_EQ(conv->get_pads_end(), (CoordinateDiff{})); //} // -//TEST(type_prop, deformable_conv_incorrect_group) +// TEST(type_prop, deformable_conv_incorrect_group) //{ // const PartialShape data_batch_shape{1, 3, 96, 96}; // const PartialShape deformable_values_shape{1, 50, 5, 5}; @@ -2719,7 +2748,7 @@ TEST(type_prop, conv_1d_back_data_batch_deduce) // } //} // -//TEST(type_prop, deformable_conv_incorrect_deformable_group) +// TEST(type_prop, deformable_conv_incorrect_deformable_group) //{ // const PartialShape data_batch_shape{1, 3, 96, 96}; // const PartialShape deformable_values_shape{1, 50, 5, 5};