forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into flush_interim_tensors
- Loading branch information
Showing
175 changed files
with
9,020 additions
and
7,395 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
152 changes: 86 additions & 66 deletions
152
src/bindings/python/src/openvino/frontend/pytorch/ts_decoder.py
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/common/low_precision_transformations/include/low_precision/slice.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (C) 2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include <memory> | ||
|
||
#include "layer_transformation.hpp" | ||
|
||
namespace ov { | ||
namespace pass { | ||
namespace low_precision { | ||
|
||
/** | ||
* @ingroup ov_transformation_common_api | ||
* @brief SliceTransformation propagates dequantization operations through Slice operation. | ||
* | ||
* For more details about the transformation, refer to | ||
* [SliceTransformation](@ref openvino_docs_OV_UG_lpt_SliceTransformation) page | ||
* in the OpenVINO Developer Guide. | ||
*/ | ||
class LP_TRANSFORMATIONS_API SliceTransformation : public LayerTransformation { | ||
public: | ||
OPENVINO_RTTI("SliceTransformation", "0"); | ||
SliceTransformation(const Params& params = Params()); | ||
bool transform(TransformationContext& context, ov::pass::pattern::Matcher& m) override; | ||
bool canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> op) const override; | ||
bool isPrecisionPreserved(std::shared_ptr<Node> layer) const noexcept override; | ||
}; | ||
|
||
} // namespace low_precision | ||
} // namespace pass | ||
} // namespace ov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// Copyright (C) 2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include <memory> | ||
|
||
#include "low_precision/slice.hpp" | ||
|
||
#include "itt.hpp" | ||
#include "openvino/util/log.hpp" | ||
#include "openvino/pass/pattern/op/wrap_type.hpp" | ||
#include "openvino/opsets/opset8.hpp" | ||
|
||
#include "low_precision/network_helper.hpp" | ||
|
||
namespace ov { | ||
namespace pass { | ||
namespace low_precision { | ||
|
||
SliceTransformation::SliceTransformation(const Params& params) : LayerTransformation(params) { | ||
MATCHER_SCOPE(SliceTransformation); | ||
auto matcher = ov::pass::pattern::wrap_type<ov::opset8::Slice>(); | ||
|
||
ov::graph_rewrite_callback callback = [this](pattern::Matcher& m) { | ||
auto op = m.get_match_root(); | ||
if (transformation_callback(op)) { | ||
return false; | ||
} | ||
return transform(*context, m); | ||
}; | ||
|
||
auto m = std::make_shared<ov::pass::pattern::Matcher>(matcher, matcher_name); | ||
this->register_matcher(m, callback); | ||
} | ||
|
||
bool SliceTransformation::transform(TransformationContext& context, ov::pass::pattern::Matcher& m) { | ||
if (!SliceTransformation::canBeTransformed(context, m.get_match_root())) { | ||
return false; | ||
} | ||
|
||
const auto strided_slice = NetworkHelper::separateInStandaloneBranch(m.get_match_root(), defaultPrecisions); | ||
auto dequantization = NetworkHelper::getDequantization(strided_slice, defaultPrecisions); | ||
const auto newOperation = moveDequantizationAfter(context, strided_slice, NetworkHelper::getDequantization(strided_slice, defaultPrecisions)); | ||
|
||
OPENVINO_DEBUG("LPT: done: ", newOperation); | ||
return true; | ||
} | ||
|
||
bool SliceTransformation::canBeTransformed(const TransformationContext& context, std::shared_ptr<Node> operation) const { | ||
if (!LayerTransformation::canBeTransformed(context, operation)) { | ||
return false; | ||
} | ||
|
||
if (!ov::is_type<ov::opset8::Slice>(operation)) { | ||
return false; | ||
} | ||
|
||
const auto dequantization = NetworkHelper::getDequantization(operation); | ||
return dequantization.isPerTensor(); | ||
} | ||
|
||
bool SliceTransformation::isPrecisionPreserved(std::shared_ptr<Node> layer) const noexcept { | ||
return true; | ||
} | ||
} // namespace low_precision | ||
} // namespace pass | ||
} // namespace ov |
Oops, something went wrong.