-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
feat: added t function of paddle frontend and related test cases #22871
Conversation
Thanks for contributing to Ivy! 😊👏 |
Hi @Infrared1029 , could you please review my PR 😃 |
If you are working on an open task, please edit the PR description to link to the issue you've created. For more information, please check ToDo List Issues Guide. Thank you 🤗 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Compliance Checks Passed!
Hi @Infrared1029 , I resolved merge conflicts and tested the function locally again. But one of the test case is failing (keyError: 'CPU'). This error popped up after I resolved the merge conflicts. Attaching below the screenshot of the error. |
# transpose | ||
@with_unsupported_dtypes({"2.5.1 and below": ("uint8", "int8", "int16")}, "paddle") | ||
@to_ivy_arrays_and_back | ||
def transpose(x, perm, name=None): | ||
return ivy.permute_dims(x, axes=perm) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove these changes as well.
|
||
# global | ||
import ivy | ||
from ivy.func_wrapper import with_unsupported_dtypes, with_supported_dtypes | ||
from ivy.functional.frontends.paddle import promote_types_of_paddle_inputs | ||
from ivy.functional.frontends.paddle.func_wrapper import ( | ||
to_ivy_arrays_and_back, | ||
) | ||
|
||
|
||
@with_supported_dtypes({"2.4.1 and above": ("int64",)}, "paddle") | ||
@to_ivy_arrays_and_back | ||
def bincount(x, weights=None, minlength=0, name=None): | ||
return ivy.bincount(x, weights=weights, minlength=minlength) | ||
|
||
|
||
# bmm | ||
@with_unsupported_dtypes({"2.5.1 and below": ("float16", "bfloat16")}, "paddle") | ||
@to_ivy_arrays_and_back | ||
def bmm(x, y, transpose_x=False, transpose_y=False, name=None): | ||
if len(ivy.shape(x)) != 3 or len(ivy.shape(y)) != 3: | ||
raise RuntimeError("input must be 3D matrices") | ||
x, y = promote_types_of_paddle_inputs(x, y) | ||
return ivy.matmul(x, y, transpose_a=transpose_x, transpose_b=transpose_y) | ||
|
||
|
||
# cholesky | ||
@with_supported_dtypes({"2.5.1 and below": ("float32", "float64")}, "paddle") | ||
@to_ivy_arrays_and_back | ||
def cholesky(x, /, *, upper=False, name=None): | ||
return ivy.cholesky(x, upper=upper) | ||
|
||
|
||
# cholesky_solve | ||
@with_supported_dtypes({"2.5.1 and below": ("float32", "float64")}, "paddle") | ||
@to_ivy_arrays_and_back | ||
def cholesky_solve(x, y, /, *, upper=False, name=None): | ||
if upper: | ||
y = ivy.matrix_transpose(y) | ||
Y = ivy.solve(y, x) | ||
return ivy.solve(ivy.matrix_transpose(y), Y) | ||
|
||
|
||
# cond | ||
@with_supported_dtypes({"2.5.1 and below": ("float32", "float64")}, "paddle") | ||
@to_ivy_arrays_and_back | ||
def cond(x, p=None, name=None): | ||
ret = ivy.cond(x, p=p, out=name) | ||
if ret.shape == (): | ||
ret = ret.reshape((1,)) | ||
return ret | ||
|
||
|
||
@with_supported_dtypes( | ||
{"2.5.1 and below": ("float32", "float64", "int32", "int64")}, "paddle" | ||
) | ||
@to_ivy_arrays_and_back | ||
def cross(x, y, /, *, axis=9, name=None): | ||
x, y = promote_types_of_paddle_inputs(x, y) | ||
return ivy.cross(x, y, axis=axis) | ||
|
||
|
||
@with_supported_dtypes({"2.4.1 and above": ("float64", "float32")}, "paddle") | ||
@to_ivy_arrays_and_back | ||
def dist(x, y, p=2): | ||
ret = ivy.vector_norm(ivy.subtract(x, y), ord=p) | ||
return ivy.reshape(ret, (1,)) | ||
|
||
|
||
# dot | ||
@with_supported_dtypes({"2.5.1 and below": ("float32", "float64")}, "paddle") | ||
@to_ivy_arrays_and_back | ||
def dot(x, y, name=None): | ||
x, y = promote_types_of_paddle_inputs(x, y) | ||
out = ivy.multiply(x, y) | ||
return ivy.sum(out, axis=ivy.get_num_dims(x) - 1, keepdims=False) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please remove all the unrelated changes except your function implementation.
This PR has been labelled as stale because it has been inactive for more than 7 days. If you would like to continue working on this PR, then please add another comment or this PR will be closed in 7 days. |
This PR has been closed because it has been marked as stale for more than 7 days with no activity. |
PR Description
This PR solves the issue named 't' (which comes under paddle.tensor.linalg). The function definition and related test cases done. All the test cases are passing locally.
Related Issue
Close #22865
Checklist
Socials: