question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support generalized universal functions

See original GitHub issue

Cupy does not offer generalized universal functions. I would like to discuss how should we proceed and implement this feature.

https://docs.scipy.org/doc/numpy/reference/c-api.generalized-ufuncs.html

TODOs

  • Parse gufuncs signatures to retrieve the core dimensions.
  • Modify core.pyx::ndarray::__array_ufunc__ to remove the signature check.
  • Given the signature, modify _kernel.pyx::ufunc::__call__ to call the function sub-arraywise. Ufunc class relies on elementwise kernels when calling _get_ufunc_kernel. GUfuncs can also call kernels operating on regular vectors.
  • Convert cupy inner1d, matmat, vecmat, matvec, matmul, outer_inner to actual gufuncs
  • Add features such as axes, order, etc.

List of numpy gufuncs (thanks to @asi1024)

(n?,k),(k,m?)->(n?,m?)
         matmul
(m,m)->(),()
         slogdet
(m,m)->()
         det
(m,m)->(m),(m,m)
         eigh_lo
         eigh_up
         eig
(m,m)->(m)
         eigvalsh_up
         eigvalsh_lo
         eigvals
(m,m),(m,n)->(m,n)
         solve
(m,m),(m)->(m)
         solve1
(m, m)->(m, m)
         inv
(m,m)->(m,m)
         cholesky_lo
(m,n)->(m)
         svd_m
(m,n)->(n)
         svd_n
(m,n)->(m,m),(m),(m,n)
         svd_m_s
(m,n)->(m,n),(n),(n,n)
         svd_n_s
(m,n)->(m,m),(m),(n,n)
         svd_m_f
(m,n)->(m,m),(n),(n,n)
         svd_n_f
(m,n),(m,nrhs),()->(n,nrhs),(nrhs),(),(m)
         lstsq_m
(m,n),(m,nrhs),()->(n,nrhs),(nrhs),(),(n)
         lstsq_n

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
rgommerscommented, Mar 19, 2020

+1 for this feature:)

Actually there’s people on the NumPy team who know much more about this than I do - I’ll ping @mattip and @seberg here for input.

0reactions
rushabh-vcommented, Mar 30, 2020

I am interested to work on this project under GSoC '20 and I am currently writing the proposal for it. Understood all the concepts quite nicely accept the feature order? Can you please elaborate a bit more on that @emcastillo ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generalized Universal Function API — NumPy v1.24 Manual
Generalized Universal Function API#. There is a general need for looping over not only functions on scalars but also over functions on vectors...
Read more >
Generalized Universal Function API — NumPy v1.9 Manual
Generalized Universal Function API¶. There is a general need for looping over not only functions on scalars but also over functions on vectors...
Read more >
Creating NumPy universal functions - Numba documentation
Those which operate on higher dimensional arrays and scalars, these are “generalized universal functions” or gufuncs ( @guvectorize below).
Read more >
Generalized Universal Function in numpy - Stack Overflow
Generalized Universal Function in numpy ... I'm trying make a generalized ufunc using numpy API. ... Someone could help me? In init function...
Read more >
Developers - Support generalized universal functions - - Bountysource
Cupy does not offer generalized universal functions. I would like to discuss how should we proceed and implement this feature.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found