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

feat: added t function of paddle frontend and related test cases #22871

Closed
wants to merge 2 commits into from

Conversation

sachelsout
Copy link
Contributor

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

  • Did you add a function?
  • Did you add the tests?
  • Did you follow the steps we provided?

Socials:

rohan_dawkhar

@github-actions
Copy link
Contributor

Thanks for contributing to Ivy! 😊👏
Here are some of the important points from our Contributing Guidelines 📝:
1. Feel free to ignore the run_tests (1), run_tests (2), … jobs, and only look at the display_test_results job. 👀 It contains the following two sections:
- Combined Test Results: This shows the results of all the ivy tests that ran on the PR. ✔️
- New Failures Introduced: This lists the tests that are passing on main, but fail on the PR Fork. Please try to make sure that there are no such tests. 💪
2. The lint / Check formatting / check-formatting tests check for the formatting of your code. 📜 If it fails, please check the exact error message in the logs and fix the same. ⚠️🔧
3. Finally, the test-docstrings / run-docstring-tests check for the changes made in docstrings of the functions. This may be skipped, as well. 📚
Happy coding! 🎉👨‍💻

@ivy-leaves ivy-leaves added the Paddle Frontend Developing the Paddle Frontend, checklist triggered by commenting add_frontend_checklist label Aug 31, 2023
@sachelsout
Copy link
Contributor Author

Hi @Infrared1029 , could you please review my PR 😃

@ivy-leaves
Copy link

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 🤗

Copy link
Contributor

@github-actions github-actions bot left a 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!

@sachelsout
Copy link
Contributor Author

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.

image

@sachelsout sachelsout changed the title added t function of paddle frontend and related test cases feat: added t function of paddle frontend and related test cases Sep 19, 2023
Comment on lines +216 to +220
# 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)
Copy link
Contributor

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.

Comment on lines +3 to +80

# 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)


Copy link
Contributor

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.

@ivy-seed ivy-seed added the Stale label Feb 22, 2024
@ivy-seed
Copy link

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.

@ivy-seed
Copy link

This PR has been closed because it has been marked as stale for more than 7 days with no activity.

@ivy-seed ivy-seed closed this Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Paddle Frontend Developing the Paddle Frontend, checklist triggered by commenting add_frontend_checklist Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

t
5 participants