Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Commit

Permalink
Add changes for Openvino 2023
Browse files Browse the repository at this point in the history
Signed-Off-by: Vijeetkumar Benni <[email protected]>
  • Loading branch information
vbenni authored and anikulk committed Dec 13, 2023
1 parent 975cf5e commit 6c7a3a2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
14 changes: 7 additions & 7 deletions ngraph_creator/operations/src/ResizeBilinear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ std::shared_ptr<ov::Node> ResizeBilinear::createNode() {
if (checkInputOperandType(1, (int32_t)OperandType::FLOAT32)) {
// In tensorflow lite, resizing by size is supported. Scaling factors are
// calculated based on output shape.
attrs.shape_calculation_mode = ov::op::v4::Interpolate::ShapeCalcMode::sizes;
attrs.shape_calculation_mode = ov::op::v4::Interpolate::ShapeCalcMode::SIZES;
width_scale = sModelInfo->ParseOperationInput<float>(mNnapiOperationIndex, 1);
height_scale = sModelInfo->ParseOperationInput<float>(mNnapiOperationIndex, 2);
out_width = (int)(input_width * width_scale);
Expand All @@ -81,15 +81,15 @@ std::shared_ptr<ov::Node> ResizeBilinear::createNode() {
width_scale = (float)out_width / (float)input_width;
height_scale = (float)out_height / (float)input_height;
} else if (checkInputOperandType(1, (int32_t)OperandType::FLOAT16)) {
attrs.shape_calculation_mode = ov::op::v4::Interpolate::ShapeCalcMode::sizes;
attrs.shape_calculation_mode = ov::op::v4::Interpolate::ShapeCalcMode::SIZES;
width_scale = sModelInfo->ParseOperationInput<_Float16>(mNnapiOperationIndex, 1);
height_scale = sModelInfo->ParseOperationInput<_Float16>(mNnapiOperationIndex, 2);
out_width = (int)(input_width * width_scale);
out_height = (int)(input_height * height_scale);
width_scale = (float)out_width / (float)input_width;
height_scale = (float)out_height / (float)input_height;
} else if (checkInputOperandType(1, (int32_t)OperandType::INT32)) {
attrs.shape_calculation_mode = ov::op::v4::Interpolate::ShapeCalcMode::sizes;
attrs.shape_calculation_mode = ov::op::v4::Interpolate::ShapeCalcMode::SIZES;
out_width = sModelInfo->ParseOperationInput<int>(mNnapiOperationIndex, 1);
out_height = sModelInfo->ParseOperationInput<int>(mNnapiOperationIndex, 2);
width_scale = (float)out_width / (float)input_width;
Expand All @@ -98,19 +98,19 @@ std::shared_ptr<ov::Node> ResizeBilinear::createNode() {

if (align_corners == true) {
attrs.coordinate_transformation_mode =
ov::op::v4::Interpolate::CoordinateTransformMode::align_corners;
ov::op::v4::Interpolate::CoordinateTransformMode::ALIGN_CORNERS;
} else if (half_pixel == true) {
attrs.coordinate_transformation_mode =
ov::op::v4::Interpolate::CoordinateTransformMode::half_pixel;
ov::op::v4::Interpolate::CoordinateTransformMode::HALF_PIXEL;
} else {
// If none of the align_corners and half_pixel are false, transformation
// mode is set to asymmetric
attrs.coordinate_transformation_mode =
ov::op::v4::Interpolate::CoordinateTransformMode::asymmetric;
ov::op::v4::Interpolate::CoordinateTransformMode::ASYMMETRIC;
}

// mode is passed as "linear" for bilinear interpolation
attrs.mode = ov::op::v4::Interpolate::InterpolateMode::linear_onnx;
attrs.mode = ov::op::v4::Interpolate::InterpolateMode::LINEAR_ONNX;

std::vector<int32_t> output_shape = {out_height, out_width};
auto outputShapeNode = createConstNode(ov::element::i32, {2}, output_shape);
Expand Down
8 changes: 4 additions & 4 deletions ngraph_creator/operations/src/ResizeNearestNeighbor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ std::shared_ptr<ov::Node> ResizeNearestNeighbor::createNode() {

if (!useNchw) inputNode = transpose(NHWC_NCHW, inputNode);

attrs.shape_calculation_mode = ov::op::v4::Interpolate::ShapeCalcMode::sizes;
attrs.shape_calculation_mode = ov::op::v4::Interpolate::ShapeCalcMode::SIZES;
// mode is passed as "nearest" for Nearest Neighbor interpolation
attrs.mode = ov::op::v4::Interpolate::InterpolateMode::nearest;
attrs.nearest_mode = ov::op::v4::Interpolate::NearestMode::floor;
Expand All @@ -88,17 +88,17 @@ std::shared_ptr<ov::Node> ResizeNearestNeighbor::createNode() {

if (align_corners == true) {
attrs.coordinate_transformation_mode =
ov::op::v4::Interpolate::CoordinateTransformMode::align_corners;
ov::op::v4::Interpolate::CoordinateTransformMode::ALIGN_CORNERS;
attrs.nearest_mode = ov::op::v4::Interpolate::NearestMode::round_prefer_ceil;
} else if (half_pixel == true) {
attrs.coordinate_transformation_mode =
ov::op::v4::Interpolate::CoordinateTransformMode::half_pixel;
ov::op::v4::Interpolate::CoordinateTransformMode::HALF_PIXEL;
attrs.nearest_mode = ov::op::v4::Interpolate::NearestMode::round_prefer_ceil;
} else {
// If none of the align_corners and half_pixel are true, transformation
// mode is set to asymmetric
attrs.coordinate_transformation_mode =
ov::op::v4::Interpolate::CoordinateTransformMode::asymmetric;
ov::op::v4::Interpolate::CoordinateTransformMode::ASYMMETRIC;
}

std::vector<int32_t> output_shape = {out_height, out_width};
Expand Down

0 comments on commit 6c7a3a2

Please sign in to comment.