Skip to content

Commit

Permalink
fixed numpy.prod failing tests (ivy-llc#21858)
Browse files Browse the repository at this point in the history
Co-authored-by: ivy-branch <[email protected]>
  • Loading branch information
2 people authored and druvdub committed Oct 14, 2023
1 parent 335026d commit ec4d28a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ivy/functional/backends/tensorflow/creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ def asarray(
try:
ret = tf.convert_to_tensor(obj, dtype)
except (TypeError, ValueError):
obj = (
obj if isinstance(obj, tf.Tensor) else tf.convert_to_tensor(obj, tf.float64)
)
ret = tf.cast(obj, dtype)
return tf.identity(ret) if copy else ret

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from_zero_dim_arrays_to_scalar,
handle_numpy_out,
)
import ivy.functional.frontends.numpy as np_frontend


@handle_numpy_out
Expand Down Expand Up @@ -114,9 +115,10 @@ def prod(
initial=None,
where=True,
):
if ivy.is_array(where):
if where is not True:
x = ivy.where(where, x, ivy.default(out, ivy.ones_like(x)), out=out)
if initial is not None:
initial = np_frontend.array(initial, dtype=dtype).tolist()
if axis is not None:
s = ivy.to_list(ivy.shape(x, as_array=True))
s[axis] = 1
Expand Down

0 comments on commit ec4d28a

Please sign in to comment.