Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/bindings/python/src/openvino/opset13/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,13 @@ def display_shared_memory_warning(warning_message: str) -> None:
if _dtype != _value.dtype:
display_shared_memory_warning(f"Converting value of {_value.dtype} to {_dtype}")
_value, _shared_memory = _value.astype(_dtype), False

# Block unsupported string tensor constants
if isinstance(_value, np.ndarray) and _value.dtype.kind in ("U", "S", "O"):
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.

Suggested change
if isinstance(_value, np.ndarray) and _value.dtype.kind in ("U", "S", "O"):
if isinstance(_value, np.ndarray) and _value.dtype.kind in ("U", "S", "O", "a"):

https://numpy.org/doc/stable/reference/arrays.dtypes.html

raise TypeError(
"String tensor constants are not supported in OpenVINO Python API"
)

# Create Constant itself:
return Constant(_value, shared_memory=_shared_memory)

Expand Down
Loading