Skip to content

Commit

Permalink
remove duplicated adjust_brightness in paddle frontend (#22271)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliagsy authored Aug 21, 2023
1 parent 5542aed commit 3cb5156
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions ivy/functional/frontends/paddle/vision/transforms.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import ivy
import ivy.numpy as np
from ivy.func_wrapper import (
with_supported_dtypes,
with_unsupported_device_and_dtypes,
Expand All @@ -10,25 +9,6 @@
)


@with_unsupported_dtypes({"2.5.1 and below": ("float16", "bfloat16")}, "paddle")
# Return the brightness-adjusted image
def adjust_brightness(img, brightness_factor):
# Assuming img is a numpy array or Ivy array
if ivy.is_array(img):
# Adjust brightness compositionally using ivy.add and ivy.multiply
adjusted_img = ivy.add(ivy.multiply(img, brightness_factor), (1 - brightness_factor))
return adjusted_img
elif isinstance(img, Image.Image):
# Convert image to Ivy array
img_array = np.array(img)
adjusted_img_array = ivy.add(ivy.multiply(img_array, brightness_factor), (1 - brightness_factor))
# Convert Ivy array back to image
adjusted_img_pil = Image.fromarray(adjusted_img_array.astype('uint8'))
return adjusted_img_pil
else:
raise ValueError("Unsupported input format")


@with_supported_dtypes(
{"2.5.1 and below": ("float32", "float64", "int32", "int64")}, "paddle"
)
Expand Down

0 comments on commit 3cb5156

Please sign in to comment.