Fixed KW for Windows (#3089)
authorIlya Churaev <ilya.churaev@intel.com>
Thu, 12 Nov 2020 10:34:28 +0000 (13:34 +0300)
committerGitHub <noreply@github.com>
Thu, 12 Nov 2020 10:34:28 +0000 (13:34 +0300)
* Fixed KW for Windows

* Fixed code style

* Fixed compilation

ngraph/core/include/ngraph/op/interpolate.hpp
ngraph/core/include/ngraph/shape.hpp
ngraph/core/reference/include/ngraph/runtime/reference/gather_nd.hpp
ngraph/core/reference/src/runtime/reference/loop.cpp

index 57d866e..c5eff08 100644 (file)
@@ -144,10 +144,10 @@ namespace ngraph
                 {
                     // specifies type of interpolation
                     // one of `nearest`, `linear`, `linear_onnx`, `cubic` Required.
-                    InterpolateMode mode;
+                    InterpolateMode mode = InterpolateMode::nearest;
                     // specifies shape calculation mode
                     // one of `sizes`, `scales` Required
-                    ShapeCalcMode shape_calculation_mode;
+                    ShapeCalcMode shape_calculation_mode = ShapeCalcMode::sizes;
                     // specify the number of pixels to add to the beginning of the image being
                     // interpolated. This addition of pixels is done before interpolation
                     // calculation.
@@ -159,25 +159,20 @@ namespace ngraph
                     // specifies how to transform the coordinate in the resized tensor to the
                     // coordinate in the original tensor. one of `half_pixel`, `pytorch_half_pixel`,
                     // `asymmetric`, `tf_half_pixel_for_nn`, `align_corners`
-                    CoordinateTransformMode coordinate_transformation_mode;
+                    CoordinateTransformMode coordinate_transformation_mode =
+                        CoordinateTransformMode::half_pixel;
                     // specifies round mode when `mode == nearest` and is used only when `mode ==
                     // nearest`. one of `round_prefer_floor`, `round_prefer_ceil`, `floor`, `ceil`,
                     // `simple`
-                    NearestMode nearest_mode;
+                    NearestMode nearest_mode = NearestMode::round_prefer_floor;
                     // a flag that specifies whether to perform anti-aliasing. default is `false`
-                    bool antialias;
+                    bool antialias = false;
                     // specifies the parameter *a* for cubic interpolation (see, e.g.
                     // [article](https://ieeexplore.ieee.org/document/1163711/)).  *cube_coeff* is
                     // used only when `mode == cubic`
-                    double cube_coeff;
+                    double cube_coeff = -0.75f;
 
-                    InterpolateAttrs()
-                        : coordinate_transformation_mode(CoordinateTransformMode::half_pixel)
-                        , nearest_mode(NearestMode::round_prefer_floor)
-                        , antialias(false)
-                        , cube_coeff(-0.75f)
-                    {
-                    }
+                    InterpolateAttrs() = default;
 
                     InterpolateAttrs(InterpolateMode mode,
                                      ShapeCalcMode shape_calculation_mode,
index 8a97149..93d439a 100644 (file)
@@ -85,7 +85,7 @@ namespace ngraph
         std::vector<size_t> strides(shape.size());
         size_t s = 1;
         auto st = strides.rbegin();
-        for (auto d = shape.rbegin(); d != shape.rend(); d++, st++)
+        for (auto d = shape.rbegin(); d != shape.rend() && st != strides.rend(); d++, st++)
         {
             *st = s;
             s *= *d;
index 9a9428c..7857aa0 100644 (file)
@@ -174,6 +174,9 @@ namespace ngraph
                 auto params_coord_iter = params_outer_transform.begin();
                 for (const Coordinate& indices_coord : indices_outer_transform)
                 {
+                    if (params_coord_iter == params_outer_transform.end() ||
+                        out_coord_iter == out_transform.end())
+                        break;
                     auto indices_index = indices_outer_transform.index(indices_coord);
                     auto params_index = params_outer_transform.index(*params_coord_iter);
                     auto output_index = out_transform.index(*out_coord_iter);
index 4250587..96d65e7 100644 (file)
@@ -143,7 +143,7 @@ namespace ngraph
                         }
 
                         // Check execution condition
-                        bool body_exec_condition;
+                        bool body_exec_condition(false);
                         body_outputs[special_ports.body_condition_output_idx]->read(
                             &body_exec_condition, sizeof(bool));
                         if (!body_exec_condition)