[PyOV] Set inference precision explicitly to fp32 for torchvision tests (#20713)
* Set fp32 * Fix flake * use properties api
This commit is contained in:
1 parent
5b583276b2
commit
31f6a95122
1 file changed
+4
-1
@@ -12,8 +12,10 @@ import torch
|
||||
import torch.nn.functional as f
|
||||
import torchvision.transforms as transforms
|
||||
|
||||
from openvino import Type
|
||||
from openvino.runtime import Core, Tensor
|
||||
from openvino.tools.mo import convert_model
|
||||
from openvino.properties.hint import inference_precision
|
||||
|
||||
from openvino.preprocess.torchvision import PreprocessConverter
|
||||
|
||||
@@ -38,7 +40,8 @@ def _infer_pipelines(test_input, preprocess_pipeline, input_channels=3):
|
||||
ov_model = PreprocessConverter.from_torchvision(
|
||||
model=ov_model, transform=preprocess_pipeline, input_example=Image.fromarray(test_input.astype("uint8"), "RGB"),
|
||||
)
|
||||
ov_model = core.compile_model(ov_model, "CPU")
|
||||
infer_config = {inference_precision: Type.f32}
|
||||
ov_model = core.compile_model(ov_model, "CPU", infer_config)
|
||||
|
||||
# Torch results
|
||||
torch_input = copy.deepcopy(test_input)
|
||||
|
||||
Reference in new issue
Block a user