Skip to content

[OpenVINO backend] Support numpy.log10 #21042

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 3 commits into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
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
5 changes: 3 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_log10
NumpyDtypeTest::test_log1p
NumpyDtypeTest::test_log
NumpyDtypeTest::test_logspace
Expand Down Expand Up @@ -99,7 +98,9 @@ NumpyOneInputOpsCorrectnessTest::test_hstack
NumpyOneInputOpsCorrectnessTest::test_imag
NumpyOneInputOpsCorrectnessTest::test_isfinite
NumpyOneInputOpsCorrectnessTest::test_isinf
NumpyOneInputOpsCorrectnessTest::test_log
NumpyOneInputOpsCorrectnessTest::test_log1p
NumpyOneInputOpsCorrectnessTest::test_log2
NumpyOneInputOpsCorrectnessTest::test_logaddexp
NumpyOneInputOpsCorrectnessTest::test_max
NumpyOneInputOpsCorrectnessTest::test_mean
NumpyOneInputOpsCorrectnessTest::test_median
Expand Down
15 changes: 14 additions & 1 deletion keras/src/backend/openvino/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,11 +832,24 @@ def linspace(

def log(x):
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)
return OpenVINOKerasTensor(ov_opset.log(x).output(0))


def log10(x):
raise NotImplementedError("`log10` 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)
log_x = ov_opset.log(x).output(0)
const_10 = ov_opset.constant(10, x_type).output(0)
log_10 = ov_opset.log(const_10).output(0)
result = ov_opset.divide(log_x, log_10).output(0)
return OpenVINOKerasTensor(result)


def log1p(x):
Expand Down