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

e2e : add an inner op of the kmeans algorithm #164

Merged
merged 2 commits into from
Jul 17, 2023
Merged

e2e : add an inner op of the kmeans algorithm #164

merged 2 commits into from
Jul 17, 2023

Conversation

ev-br
Copy link
Collaborator

@ev-br ev-br commented Jul 15, 2023

Add a clustering primitive, essentially a single iteration of the k-means algorithm, from https://realpython.com/numpy-array-programming/#clustering-algorithms
This is of course two lines of numpy :-).

Observations:


# np.linalg.norm replacement (2-norm only), https://github.com/pytorch/pytorch/issues/105269
def norm(a, axis):
s = (a.conj() * a).real
Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't support complex numbers in inductor, so this could very well be a ** 2

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

so pytorch/pytorch#105267 is a wontfix?

Copy link
Collaborator

Choose a reason for hiding this comment

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

yup

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

#165 has an example of working around not having complex dtypes.

@ev-br ev-br merged commit 886f52f into main Jul 17, 2023
@ev-br ev-br deleted the e2e_mandelbrot branch July 17, 2023 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants