Skip to content

[Keras 3 OpenVINO Backend]: Support numpy.log1p operation #29487 #21129

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

Merged
merged 6 commits into from
Apr 22, 2025
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 0 additions & 2 deletions keras/src/backend/openvino/excluded_concrete_tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ NumpyDtypeTest::test_isfinite
NumpyDtypeTest::test_isinf
NumpyDtypeTest::test_isnan
NumpyDtypeTest::test_linspace
NumpyDtypeTest::test_log1p
NumpyDtypeTest::test_logaddexp
NumpyDtypeTest::test_logspace
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please also remove NumpyOneInputOpsCorrectnessTest::test_log1p below

NumpyDtypeTest::test_matmul_
Expand Down Expand Up @@ -98,7 +97,6 @@ NumpyOneInputOpsCorrectnessTest::test_hstack
NumpyOneInputOpsCorrectnessTest::test_imag
NumpyOneInputOpsCorrectnessTest::test_isfinite
NumpyOneInputOpsCorrectnessTest::test_isinf
NumpyOneInputOpsCorrectnessTest::test_log1p
NumpyOneInputOpsCorrectnessTest::test_logaddexp
NumpyOneInputOpsCorrectnessTest::test_max
NumpyOneInputOpsCorrectnessTest::test_mean
Expand Down
11 changes: 10 additions & 1 deletion keras/src/backend/openvino/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,8 +853,17 @@ def log10(x):


def log1p(x):
raise NotImplementedError("`log1p` is not supported with openvino backend")
x = get_ov_output(x)
x_type = x.get_element_type()

if x_type.is_integral():
x_type = OPENVINO_DTYPES[config.floatx()]
x = ov_opset.convert(x, x_type)

one_const = ov_opset.constant(1, x_type).output(0)
added = ov_opset.add(x, one_const).output(0)
result = ov_opset.log(added).output(0)
return OpenVINOKerasTensor(result)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add more one blank line to pass CI jobs

def log2(x):
x = get_ov_output(x)
Expand Down
Loading