Skip to content

Introduce new evaluate API#7848

Merged
ilya-lavrenov merged 7 commits intoopenvinotoolkit:masterfrom
ilyachur:introduce_evaluate_for_ov_tensor
Oct 8, 2021
Merged

Introduce new evaluate API#7848
ilya-lavrenov merged 7 commits intoopenvinotoolkit:masterfrom
ilyachur:introduce_evaluate_for_ov_tensor

Conversation

@ilyachur
Copy link
Copy Markdown
Contributor

@ilyachur ilyachur commented Oct 5, 2021

Details:

  • Introduce new evaluate methods which work with ov::runtime::Tensor
  • ov::Function::evaluate(HostTensorVector ...) calls ov::Function::evaluate(ov::runtime::TensorVector ...) inside
  • ov::Node::evaluate(ov::runtime::TensorVector ...) by default calls ov::Node::evaluate(HostTensorVector ...)`
  • new operations can implement only evaluate methods with ov::runtime::Tensors
  • old evaluate methods will be deprecated in future PRs

@ilyachur ilyachur added the category: Core OpenVINO Core (aka ngraph) label Oct 5, 2021
@ilyachur ilyachur added this to the 2022.1 milestone Oct 5, 2021
@ilya-lavrenov ilya-lavrenov self-assigned this Oct 7, 2021
@ilya-lavrenov ilya-lavrenov enabled auto-merge (squash) October 7, 2021 21:26
@ilya-lavrenov ilya-lavrenov merged commit ff31ac5 into openvinotoolkit:master Oct 8, 2021
@ilyachur ilyachur deleted the introduce_evaluate_for_ov_tensor branch October 8, 2021 04:37
inline ov::runtime::Tensor create_tmp_tensor(const ngraph::HostTensorPtr& tensor) {
if (tensor->get_partial_shape().is_static()) {
ov::Shape shape = tensor->get_shape();
return std::move(ov::runtime::Tensor(tensor->get_element_type(), shape, tensor->get_data_ptr()));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: std::move is not needed here, as it is already 'r-value'

for (const auto& tensor : tensors) {
result.emplace_back(create_tmp_tensor(tensor));
}
return std::move(result);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: std::move is not needed here as all necessary optimizations will be done by 'NRVO' (if not disabled explicitly by user)

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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants