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.

Common APIs across array libraries

See original GitHub issue

Overview

To help further the discussion of what array APIs should be included in the standard, I’ve compiled a (WIP) list of common APIs across various array libraries.

This list should provide some indication as to API importance from the library development perspective based on API curation and need and should summarize current existing practice.

Goal

To standardize a common set of core APIs and minimal signatures (i.e., argument order and keyword arguments) that every array API should implement in order to be array specification compliant.

Method

I compiled the list by doing the following:

  1. Generating a list of APIs based on publicly documented array APIs (e.g., by scraping website documentation).
  2. Computing the intersection across the individual datasets.

The following libraries were analyzed:

  • numpy
  • cupy
  • dask.array
  • jax
  • mxnet
  • pytorch
  • tensorflow

APIs

The following APIs were found to be common across the above libraries (using NumPy’s naming conventions):

angle
arange
arccos
arcsin
arctan
arctan2
argmax
argmin
array
ceil
concatenate
conj
cos
cosh
cumprod
cumsum
einsum
exp
expm1
eye
flip
floor
full
imag
linalg.cholesky
linalg.inv
linalg.norm
linalg.qr
linalg.solve
linalg.svd
linspace
log
log1p
logaddexp
matmul
maximum
mean
meshgrid
minimum
ones
ones_like
prod
real
reshape
roll
sign
sin
sinh
sqrt
square
squeeze
stack
std
sum
tan
tanh
tensordot
trace
transpose
trunc
var
where
zeros
zeros_like

We can split these APIs into various categories as follows…

Array Creation

arange
array
eye
full
linspace
meshgrid
ones
ones_like
zeros
zeros_like

Array Manipulation

concatenate
flip
reshape
roll
squeeze
stack

Special Functions

ceil
exp
expm1
floor
log
log1p
logaddexp
maximum
minimum
sign
square
sqrt
trunc

Trigonometry

arccos
arcsin
arctan
arctan2
cos
cosh
sin
sinh
tan
tanh

Complex Numbers

angle
conj
imag
real

Reductions

cumprod
cumsum
mean
prod
std
sum
var

Linear Algebra

einsum
linalg.cholesky
linalg.inv
linalg.norm
linalg.qr
linalg.solve
linalg.svd
matmul
tensordot
trace
transpose

Indexing

argmax
argmin
where

Next Steps

  1. Provide the intersection of keyword arguments for each of the above APIs.

Questions

  1. While the above uses NumPy naming conventions, some of the above libraries have chosen to deviate from NumPy conventions (absolute vs abs). Are there APIs which should be aliased differently?
  2. How to handle/encode missing data in element-wise functions (ufuncs) and reductions?
  3. Can we standardize a core subset of the above APIs in terms of method names and a limited set of keyword arguments?
  4. To allow for API extensibility, can we specify a common API for arbitrary element-wise and/or axis-wise operations (e.g., apply, reduce)?

Feedback is welcome. 😃

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
amuellercommented, Jun 15, 2020

For 1) so this listing excludes these functions, right? Should we manually alias them to get a more complete list?

Also, shouldn’t we also look at the complement, i.e. all the other functions that are not in each library and list in which libraries they are?

0reactions
rgommerscommented, Sep 16, 2020

This is all done, and https://github.com/data-apis/array-api-comparison holds the up-to-date data and tooling. So I’ll close this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

data-apis/array-api-comparison: Data and tooling to ...
Data and tooling to compare the API surfaces of various array libraries. ... and differences across array libraries, we can derive a common...
Read more >
Array API compatibility library
Array API compatibility library. This is a small wrapper around NumPy and CuPy that is compatible with the Array API standard. See also...
Read more >
Array Libraries Interoperability - Quansight Labs
The Array API Demo walks you through the details and processes involved to make an array consumer library like SciPy more interoperable with ......
Read more >
What are the types of APIs and their differences?
APIs allow a vast array of unrelated software products to integrate and interoperate with other software and data.
Read more >
Mining Likely Analogical APIs across Third-Party Libraries via ...
cation for searching analogical APIs across these pairs of ... provide a direct common context to bridge the otherwise ... joins the array...
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