Skip to content

Implement dot function in OpenVINO backend for Keras #20987

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7c6facd
Update numpy.py
Hmm-1224 Mar 5, 2025
e5a0b8a
Create pytest.int
Hmm-1224 Mar 5, 2025
898f829
Rename pytest.int to pytest.ini
Hmm-1224 Mar 5, 2025
98afd0f
Update excluded_concrete_tests.txt
Hmm-1224 Mar 5, 2025
1d4baac
Update numpy.py
Hmm-1224 Mar 5, 2025
3b2520a
Update numpy.py
Hmm-1224 Mar 5, 2025
1072f95
Update numpy.py
Hmm-1224 Mar 5, 2025
7492db6
Update numpy.py
Hmm-1224 Mar 6, 2025
68f87d5
Update numpy.py
Hmm-1224 Mar 6, 2025
9d5c5d5
Update numpy.py
Hmm-1224 Mar 6, 2025
a9c5548
Update numpy.py
Hmm-1224 Mar 6, 2025
e8fcdec
Update numpy.py
Hmm-1224 Mar 6, 2025
583fc4e
Update numpy.py
Hmm-1224 Mar 6, 2025
8487376
Update numpy.py
Hmm-1224 Mar 6, 2025
ff6a583
Fixed import formatting using ruff
Hmm-1224 Mar 6, 2025
820339d
Update numpy.py
Hmm-1224 Mar 6, 2025
0deca35
Update excluded_concrete_tests.txt
Hmm-1224 Mar 6, 2025
4510314
Update pytest.ini
Hmm-1224 Mar 6, 2025
b008405
rmeoved pytest.ini
Hmm-1224 Mar 6, 2025
942cdf7
Update numpy.py
Hmm-1224 Mar 6, 2025
ca6a39f
Update numpy.py
Hmm-1224 Mar 6, 2025
223441f
format changed
Hmm-1224 Mar 6, 2025
fd1e641
Update excluded_concrete_tests.txt
Hmm-1224 Mar 6, 2025
80820f9
Update numpy.py
Hmm-1224 Mar 6, 2025
8a55586
Update numpy.py
Hmm-1224 Mar 6, 2025
4608b0f
Update numpy.py
Hmm-1224 Mar 6, 2025
d9a796a
format changed
Hmm-1224 Mar 6, 2025
2e3a46a
Update numpy.py
Hmm-1224 Mar 6, 2025
3ec59cc
Update numpy.py
Hmm-1224 Mar 6, 2025
951b488
Update numpy.py
Hmm-1224 Mar 6, 2025
8560b32
Update numpy.py
Hmm-1224 Mar 6, 2025
24391a5
Update numpy.py
Hmm-1224 Mar 6, 2025
251b8ec
format changed
Hmm-1224 Mar 6, 2025
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
6 changes: 3 additions & 3 deletions keras/src/backend/openvino/excluded_concrete_tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ NumpyDtypeTest::test_cumsum_bool
NumpyDtypeTest::test_diag
NumpyDtypeTest::test_diff
NumpyDtypeTest::test_digitize
NumpyDtypeTest::test_dot

NumpyDtypeTest::test_einsum
NumpyDtypeTest::test_empty
NumpyDtypeTest::test_exp2
Expand Down Expand Up @@ -101,7 +101,7 @@ NumpyOneInputOpsCorrectnessTest::test_cumprod
NumpyOneInputOpsCorrectnessTest::test_diag
NumpyOneInputOpsCorrectnessTest::test_diagonal
NumpyOneInputOpsCorrectnessTest::test_diff
NumpyOneInputOpsCorrectnessTest::test_dot

NumpyOneInputOpsCorrectnessTest::test_exp
NumpyOneInputOpsCorrectnessTest::test_expand_dims
NumpyOneInputOpsCorrectnessTest::test_flip
Expand Down Expand Up @@ -177,4 +177,4 @@ NumpyTwoInputOpsCorrectnessTest::test_quantile
NumpyTwoInputOpsCorrectnessTest::test_take_along_axis
NumpyTwoInputOpsCorrectnessTest::test_tensordot
NumpyTwoInputOpsCorrectnessTest::test_vdot
NumpyTwoInputOpsCorrectnessTest::test_where
NumpyTwoInputOpsCorrectnessTest::test_where
18 changes: 17 additions & 1 deletion keras/src/backend/openvino/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,23 @@ def digitize(x, bins):


def dot(x, y):
raise NotImplementedError("`dot` is not supported with openvino backend")
element_type = None
if isinstance(x, OpenVINOKerasTensor):
element_type = x.output.get_element_type()
if isinstance(y, OpenVINOKerasTensor):
element_type = y.output.get_element_type()
x = get_ov_output(x, element_type)
y = get_ov_output(y, element_type)
x, y = _align_operand_types(x, y, "dot()")
if len(x.shape) == 0:
x = ov_opset.reshape(x, [1], special_zero=False)
if len(y.shape) == 0:
y = ov_opset.reshape(y, [1], special_zero=False)
if len(x.shape) == 1 and len(y.shape) == 1:
return OpenVINOKerasTensor(
ov_opset.reduce_sum(ov_opset.multiply(x, y), axes=[0]).output(0)
)
return OpenVINOKerasTensor(ov_opset.matmul(x, y, False, False).output(0))


def empty(shape, dtype=None):
Expand Down
8 changes: 8 additions & 0 deletions key
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABCLRj2E1I
LvRlmB4ymaczdfAAAAGAAAAAEAAAAzAAAAC3NzaC1lZDI1NTE5AAAAINywxPtbw0W5GocS
qmZrXKw5vhWXd2NUlzpAraTtD/KTAAAAoOg0DRODsTEAExhmBp9Iez48wRWL2dPg2MiKf6
IJGyR9/jN3nodGNqbCfmHqxLhQLgeKP8TGwd2/CGF9p3slIpA3n/s/32smNaIduhHfZhJY
lhe5Qhol2zBfhcPZHhNMfhVnOgQSJoq8vel29A9nHtK+rPFWfeo1vQYXzmxMTfsoD9LmQB
026HMOHIUJpgY8lNqnfl16K0rn8BC4RxLzOzM=
-----END OPENSSH PRIVATE KEY-----
1 change: 1 addition & 0 deletions key.pub
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINywxPtbw0W5GocSqmZrXKw5vhWXd2NUlzpAraTtD/KT [email protected]
Loading