File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
keras/src/backend/openvino Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 1
1
import numpy as np
2
2
import openvino .runtime .opset14 as ov_opset
3
- from openvino import Type , Tensor
3
+ from openvino import Type
4
4
5
5
from keras .src .backend import config
6
6
from keras .src .backend .common import dtypes
@@ -573,7 +573,10 @@ def empty(shape, dtype=None):
573
573
shape = list (shape )
574
574
elif isinstance (shape , int ):
575
575
shape = [shape ]
576
- empty_tensor = Tensor (ov_type , shape )
576
+ shape_node = ov_opset .constant (shape , Type .i32 ).output (0 )
577
+ zero_tensor = ov_opset .broadcast (ov_opset .constant (0 , ov_type ), shape_node ).output (0 )
578
+ empty_tensor = ov_opset .convert (zero_tensor , ov_type ).output (0 )
579
+ print (f"Empty tensor:{ empty_tensor } " )
577
580
return OpenVINOKerasTensor (empty_tensor )
578
581
579
582
You can’t perform that action at this time.
0 commit comments