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

class_center_sample #21628

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 5 additions & 0 deletions ivy/functional/frontends/paddle/nn/functional/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,8 @@ def interpolate(
def linear(x, weight, bias=None, name=None):
weight = ivy.swapaxes(weight, -1, -2)
return ivy.linear(x, weight, bias=bias)

@to_ivy_arrays_and_back
@with_supported_dtypes({"2.5.1 and below": ("float32", "float64")}, "paddle")
def class_center_sample ( label, num_classes, num_samples, group=None ):
return ivy.class_center_sample( label, num_classes, num_samples, group=group )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ivy doesn't have this function implemented on our API

Original file line number Diff line number Diff line change
Expand Up @@ -416,3 +416,33 @@ def test_linear(
weight=weight,
bias=bias,
)

# class_center_sample
@handle_frontend_test(
fn_tree="paddle.nn.functional.common.class_center_sample",
dtype_x_weight_bias=x_and_linear(
dtypes=helpers.get_dtypes("float", full=False),
),
)
def test_class_center_sample(
*,
dtype_x_weight_bias,
on_device,
fn_tree,
backend_fw,
frontend,
test_flags,
):
dtype, x, weight, bias = dtype_x_weight_bias
weight = ivy.swapaxes(weight, -1, -2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ivy dependency should be removed

helpers.test_frontend_function(
input_dtypes=dtype,
frontend=frontend,
backend_to_test=backend_fw,
test_flags=test_flags,
fn_tree=fn_tree,
on_device=on_device,
x=x,
weight=weight,
bias=bias,
)
Loading