openvino icon indicating copy to clipboard operation
openvino copied to clipboard

[Feature Request]: Convolution

Open lcx1874000 opened this issue 9 months ago • 1 comments

Request Description

class ov::op::v1::Convolution。Convolution, can you use this API like torch.nn.Conv2d in Pytorch? I refer to the build model in the official example. This method requires compile_model. I want to call this convolution separately. I looked at the documentation but could not find the relevant interface. Do you support the above operations

Feature Use Case

Convolution, can you use this API like torch.nn.Conv2d in Pytorch?

Issue submission checklist

  • [X] The feature request or improvement must be related to OpenVINO

lcx1874000 avatar Apr 29 '24 09:04 lcx1874000

Hi @lcx1874000,

As I understand, you want to create the single layer model that contain OV Convolution and run it for inference. Here is an example how to create the single layer model with Divide operation:

import numpy as np
import openvino.runtime.opset9 as ov
from openvino.runtime import Model, Core

# create a model with TopK
x = ov.parameter([1], name="x", dtype=np.int32)
y = ov.parameter([1], name="y", dtype=np.int32)
divide = ov.divide(x, y)
model = Model([divide], [x, y], "model")

# infer it on CPU
core = Core()
compiled_model = core.compile_model(model, "CPU")
output = compiled_model.infer_new_request({0: np.array([4], dtype=np.int32), 1: np.array([-3], dtype=np.int32)})

Since you want to create with Convolution, please refer to Convolution Python documentation: https://docs.openvino.ai/2024/api/ie_python_api/_autosummary/openvino.runtime.opset14.convolution.html Examples with convolution in test: https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/python/tests/test_graph/test_convolution.py

Pay attention that we have no eager execution mode for inference. Please elaborate your request more if I missed somenthing.

Best regards, Roman

rkazants avatar Apr 30 '24 04:04 rkazants