Skip to content

Commit 3cb5156

Browse files
authored
remove duplicated adjust_brightness in paddle frontend (#22271)
1 parent 5542aed commit 3cb5156

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

ivy/functional/frontends/paddle/vision/transforms.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import ivy
2-
import ivy.numpy as np
32
from ivy.func_wrapper import (
43
with_supported_dtypes,
54
with_unsupported_device_and_dtypes,
@@ -10,25 +9,6 @@
109
)
1110

1211

13-
@with_unsupported_dtypes({"2.5.1 and below": ("float16", "bfloat16")}, "paddle")
14-
# Return the brightness-adjusted image
15-
def adjust_brightness(img, brightness_factor):
16-
# Assuming img is a numpy array or Ivy array
17-
if ivy.is_array(img):
18-
# Adjust brightness compositionally using ivy.add and ivy.multiply
19-
adjusted_img = ivy.add(ivy.multiply(img, brightness_factor), (1 - brightness_factor))
20-
return adjusted_img
21-
elif isinstance(img, Image.Image):
22-
# Convert image to Ivy array
23-
img_array = np.array(img)
24-
adjusted_img_array = ivy.add(ivy.multiply(img_array, brightness_factor), (1 - brightness_factor))
25-
# Convert Ivy array back to image
26-
adjusted_img_pil = Image.fromarray(adjusted_img_array.astype('uint8'))
27-
return adjusted_img_pil
28-
else:
29-
raise ValueError("Unsupported input format")
30-
31-
3212
@with_supported_dtypes(
3313
{"2.5.1 and below": ("float32", "float64", "int32", "int64")}, "paddle"
3414
)

0 commit comments

Comments
 (0)