Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GoodFirstIssue][Core] Created AvgPoolBase #23483

Merged

Conversation

Vladislav-Denisov
Copy link
Contributor

Details:

  • Created AvgPoolBase class with the common functionality from AvgPool-1 and AvgPool-14

Tickets:

@Vladislav-Denisov Vladislav-Denisov requested a review from a team as a code owner March 15, 2024 12:40
@github-actions github-actions bot added category: Core OpenVINO Core (aka ngraph) category: CPP API OpenVINO CPP API bindings labels Mar 15, 2024
const PadType& auto_pad = op::PadType::EXPLICIT);

void validate_and_infer_types() override;
bool visit_attributes(AttributeVisitor& visitor) override;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest adding a similar method to the MaxPoolBase class with common attributes for v1, v8 and v14, as I did for AvgPoolBase

For example for MaxPool-8:

bool MaxPool::visit_attributes(AttributeVisitor& visitor) {
    OV_OP_SCOPE(v8_MaxPool_visit_attributes);
    visitor.on_attribute("index_element_type", m_index_element_type);
    visitor.on_attribute("axis", m_axis);
    return util::MaxPoolBase::visit_attributes(visitor);
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, let's have it in a separate PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also do it in a separate Good First Issue. @Vladislav-Denisov would you like to create one or do you prefer I'd do it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@p-wysocki Do you mean to create new GoodFirstIssue or only new PR?

I would be glad to create new PR to update MaxPoolBase implementation 😃

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR - certainly, Good First Issue - if you feel like it you can create one, if not, I'll do it, just let me know. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can create both a PR and a GoodFirstIssue.
Thanks!

@Vladislav-Denisov
Copy link
Contributor Author

@p-wysocki Hi! Could you review, please?

@rkazants rkazants added the ExternalPR External contributor label Mar 15, 2024
@mlukasze mlukasze requested review from t-jankowski and praasz March 15, 2024 12:57
Comment on lines 91 to 93
void set_rounding_type(op::RoundingType rounding_type) {
m_rounding_type = rounding_type;
}
Copy link
Member

@rkazants rkazants Mar 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@p-wysocki, what if developer set torch rounding type to v1 version of AvgPool. Do we have check for this?
Do we really need this method for setting rounding type and what use cases? I think - not. Other setters are also questionable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This setter can be required form GPU plugin as there is pattern to create op, set required attributes call shape infer (there is no node validation).
This attribute is important to be possible to set it.
The rounding mode is validated and torch mode should throw error for versions which are not supported. @p-wysocki could you confirm?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is correct, it's validated here:

if (!has_torch_ceil_mode<TOp>()) {
const auto is_ceil_torch = op->get_rounding_type() == RoundingType::CEIL_TORCH;
NODE_VALIDATION_CHECK(op, !is_ceil_torch, "Rounding CEIL_TORCH is not supported.");
}

const PadType& auto_pad = op::PadType::EXPLICIT);

void validate_and_infer_types() override;
bool visit_attributes(AttributeVisitor& visitor) override;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, let's have it in a separate PR.

src/core/src/op/util/avg_pool_base.cpp Outdated Show resolved Hide resolved
src/core/src/op/util/avg_pool_base.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@p-wysocki p-wysocki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution!

LGTM, I have no other concerns than the ones from @praasz and @t-jankowski. Please request review once again when they're addressed. :)

const PadType& auto_pad = op::PadType::EXPLICIT);

void validate_and_infer_types() override;
bool visit_attributes(AttributeVisitor& visitor) override;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also do it in a separate Good First Issue. @Vladislav-Denisov would you like to create one or do you prefer I'd do it?

Comment on lines 91 to 93
void set_rounding_type(op::RoundingType rounding_type) {
m_rounding_type = rounding_type;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is correct, it's validated here:

if (!has_torch_ceil_mode<TOp>()) {
const auto is_ceil_torch = op->get_rounding_type() == RoundingType::CEIL_TORCH;
NODE_VALIDATION_CHECK(op, !is_ceil_torch, "Rounding CEIL_TORCH is not supported.");
}

@Vladislav-Denisov Vladislav-Denisov force-pushed the feature/core/avgPoolBase branch from 62cca0e to 0fa3244 Compare March 18, 2024 15:55
Copy link
Contributor

@p-wysocki p-wysocki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for your contribution :)

const PadType& auto_pad = op::PadType::EXPLICIT);

void validate_and_infer_types() override;
bool visit_attributes(AttributeVisitor& visitor) override;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR - certainly, Good First Issue - if you feel like it you can create one, if not, I'll do it, just let me know. :)

@p-wysocki
Copy link
Contributor

build_jenkins

@mlukasze
Copy link
Contributor

please correct formatting to pass clang tests :)

@p-wysocki
Copy link
Contributor

build_jenkins

src/core/src/op/avg_pool.cpp Outdated Show resolved Hide resolved
src/core/src/op/avg_pool.cpp Outdated Show resolved Hide resolved
src/core/src/op/avg_pool.cpp Show resolved Hide resolved
@praasz
Copy link
Contributor

praasz commented Mar 22, 2024

build_jenkins

@praasz praasz added this pull request to the merge queue Mar 26, 2024
@akladiev akladiev removed this pull request from the merge queue due to the queue being cleared Mar 26, 2024
@mlukasze mlukasze requested a review from rkazants March 27, 2024 05:47
@mlukasze mlukasze added this pull request to the merge queue Mar 27, 2024
Merged via the queue into openvinotoolkit:master with commit 91d3d8a Mar 27, 2024
109 checks passed
@mlukasze mlukasze added this to the 2024.1 milestone Mar 27, 2024
@mlukasze
Copy link
Contributor

your first PR for OV has been merged @Vladislav-Deniso, congrats and thank you for support!

bbielawx pushed a commit to bbielawx/openvino that referenced this pull request Apr 12, 2024
### Details:
- *Created `AvgPoolBase` class with the common functionality from
`AvgPool-1` and `AvgPool-14`*

### Tickets:
 - *openvinotoolkit#23465
alvoron pushed a commit to alvoron/openvino that referenced this pull request Apr 29, 2024
### Details:
- *Created `AvgPoolBase` class with the common functionality from
`AvgPool-1` and `AvgPool-14`*

### Tickets:
 - *openvinotoolkit#23465
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Core OpenVINO Core (aka ngraph) category: CPP API OpenVINO CPP API bindings ExternalPR External contributor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Good First Issue]: Simplify AvgPool-14 and AvgPool-1 by implementing AvgPoolBase
6 participants