Skip to content
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

Add dropout function for MindSpore Frontend #21362

Merged
merged 4 commits into from
Feb 29, 2024
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
19 changes: 19 additions & 0 deletions ivy/functional/frontends/mindspore/ops/function/nn_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,25 @@ def conv3d(
return _conv(input, weight, bias, stride, padding, dilation, groups)


@with_supported_dtypes(
{
"2.0.0 and below": (
"int8",
"int16",
"int32",
"int64",
"float16",
"float32",
"float64",
)
},
"mindspore",
)
@to_ivy_arrays_and_back
def dropout(input, p=0.5, training=True, seed=None):
return ivy.dropout(input, p, training=training, seed=seed)


@with_supported_dtypes(
{
"2.0.0 and below": (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,40 @@ def test_mindspore_conv3d(
)


#dropout
@pytest.mark.skip("Testing pipeline not yet implemented")
@handle_frontend_test(
fn_tree="mindspore.ops.function.nn_func.dropout",
d_type_and_x=helpers.dtype_and_values(),
p=helpers.floats(min_value=0.0, max_value=1.0),
training=st.booleans(),
seed=helpers.ints(min_value=0, max_value=100)
)
def test_mindspore_dropout(
*,
d_type_and_x,
p,
training,
seed,
on_device,
fn_tree,
frontend,
test_flags,
):
dtype, x = d_type_and_x
ret, frontend_ret = helpers.test_frontend_function(
input_dtypes=dtype,
frontend=frontend,
test_flags=test_flags,
fn_tree=fn_tree,
on_device=on_device,
input=x[0],
p=p,
training=training,
seed=seed,
)


# dropout2d
@pytest.mark.skip("Testing pipeline not yet implemented")
@handle_frontend_test(
Expand Down
Loading