Skip to content

Commit

Permalink
Added LinSpace to Raw_Ops for tf frontends (ivy-llc#10871)
Browse files Browse the repository at this point in the history
Co-authored-by: sherry30 <[email protected]>
  • Loading branch information
sdk2k01 and sherry30 authored Feb 24, 2023
1 parent 84ab76c commit fafd8bd
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ivy/functional/frontends/tensorflow/raw_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,3 +607,9 @@ def Elu(features, name=None):
"float64",
),
}


# @with_unsupported_dtypes({"2.9.1 and below": ()}, "tensorflow")
@to_ivy_arrays_and_back
def LinSpace(*, start, stop, num, name=None):
return ivy.linspace(start, stop, num)
55 changes: 55 additions & 0 deletions ivy_tests/test_ivy/test_frontends/test_tensorflow/test_raw_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -3057,3 +3057,58 @@ def test_tensorflow_Elu(
features=x[0],
name=name,
)


@st.composite
def _LinSpace_helper(draw):
shape = ()
dtype = draw(st.sampled_from(["float32", "float64"]))

# Param: start
start = draw(
helpers.array_values(
dtype=dtype,
shape=shape,
min_value=-5.0,
max_value=5.0,
),
)

# Param: stop
stop = draw(
helpers.array_values(
dtype=dtype,
shape=shape,
min_value=-4.0,
max_value=10.0,
),
)

return [dtype] * 2, start, stop


@handle_frontend_test(
fn_tree="tensorflow.raw_ops.LinSpace",
dtype_and_params=_LinSpace_helper(),
num=helpers.ints(min_value=2, max_value=10),
)
def test_tensorflow_LinSpace(
*,
dtype_and_params,
num,
on_device,
fn_tree,
frontend,
test_flags,
):
dtype, start, stop = dtype_and_params
helpers.test_frontend_function(
input_dtypes=dtype,
frontend=frontend,
test_flags=test_flags,
fn_tree=fn_tree,
start=start,
stop=stop,
num=num,
on_device=on_device,
)

0 comments on commit fafd8bd

Please sign in to comment.