[Opset13][pyAPI] Python API BitwiseNot-13 (#20265)
* Add pyAPI BitwiseNot-13 * Update src/bindings/python/src/openvino/runtime/opset13/ops.py Co-authored-by: Katarzyna Mitrus <katarzyna.mitrus@intel.com> * Remove whitespace from ops.py --------- Co-authored-by: Katarzyna Mitrus <katarzyna.mitrus@intel.com>
This commit is contained in:
parent
b358d283d0
commit
670fff062e
@ -19,6 +19,7 @@ from openvino.runtime.opset5.ops import batch_norm_inference
|
||||
from openvino.runtime.opset2.ops import batch_to_space
|
||||
from openvino.runtime.opset1.ops import binary_convolution
|
||||
from openvino.runtime.opset13.ops import bitwise_and
|
||||
from openvino.runtime.opset13.ops import bitwise_not
|
||||
from openvino.runtime.opset13.ops import bitwise_or
|
||||
from openvino.runtime.opset13.ops import bitwise_xor
|
||||
from openvino.runtime.opset3.ops import broadcast
|
||||
|
@ -8,7 +8,7 @@ from typing import Optional
|
||||
|
||||
from openvino.runtime import Node
|
||||
from openvino.runtime.opset_utils import _get_node_factory
|
||||
from openvino.runtime.utils.decorators import binary_op, nameable_op
|
||||
from openvino.runtime.utils.decorators import binary_op, nameable_op, unary_op
|
||||
from openvino.runtime.utils.types import (
|
||||
NodeInput,
|
||||
as_nodes,
|
||||
@ -43,6 +43,25 @@ def bitwise_and(
|
||||
)
|
||||
|
||||
|
||||
@unary_op
|
||||
def bitwise_not(
|
||||
node: NodeInput,
|
||||
name: Optional[str] = None,
|
||||
) -> Node:
|
||||
"""Return node which performs bitwise NOT operation on input node element-wise.
|
||||
|
||||
For boolean input tensors, operator is equivalent to logical_not.
|
||||
|
||||
:param node: Tensor of integer or boolean datatype providing data.
|
||||
:param name: The optional new name for output node.
|
||||
:return: The node performing bitwise NOT operation on the given tensor.
|
||||
"""
|
||||
return _get_node_factory_opset13().create(
|
||||
"BitwiseNot",
|
||||
[node],
|
||||
)
|
||||
|
||||
|
||||
@binary_op
|
||||
def bitwise_or(
|
||||
left_node: NodeInput,
|
||||
|
@ -6,7 +6,7 @@ import numpy as np
|
||||
import pytest
|
||||
|
||||
import openvino.runtime as ov_runtime
|
||||
import openvino.runtime.opset10 as ov
|
||||
import openvino.runtime.opset13 as ov
|
||||
from openvino.runtime import Shape, Type
|
||||
|
||||
R_TOLERANCE = 1e-6 # global relative tolerance
|
||||
@ -203,3 +203,21 @@ def test_gelu_tanh_operator_with_array():
|
||||
assert model.get_type_name() == "Gelu"
|
||||
assert model.get_output_element_type(0) == ov_runtime.Type.f32
|
||||
assert list(model.get_output_shape(0)) == [2, 2]
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("input_data", "dtype"),
|
||||
[
|
||||
(np.array([True, False, True, False]), ov_runtime.Type.boolean),
|
||||
(np.array([True]), ov_runtime.Type.boolean),
|
||||
(np.array([False]), ov_runtime.Type.boolean),
|
||||
(np.array([0, 3, 7, 256], dtype=np.uint16), ov_runtime.Type.u16),
|
||||
(np.array([[-7, 0], [256, 1]], dtype=np.int32), ov_runtime.Type.i32),
|
||||
],
|
||||
)
|
||||
def test_bitwise_not(input_data, dtype):
|
||||
node = ov.bitwise_not(input_data)
|
||||
assert node.get_output_size() == 1
|
||||
assert node.get_type_name() == "BitwiseNot"
|
||||
assert node.get_output_element_type(0) == dtype
|
||||
assert list(node.get_output_shape(0)) == list(input_data.shape)
|
||||
|
Loading…
Reference in New Issue
Block a user