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.

np.einsum will not accept NoneType for 'out' parameter

See original GitHub issue

np.einsum raises an error when NoneType (‘None’) is passed to the ‘out’ keyword argument. This behavior is not in line with the expected behavior for the out keyword argument of ufunc methods.

Reproducing code example:

import numpy as np
np.einsum('i,j',[1],[2],out=None)

Error message:

Traceback (most recent call last):

  File "<ipython-input-2-32138e47a353>", line 1, in <module>
    np.einsum('i,j',[1],[2],out=None)

  File "<__array_function__ internals>", line 6, in einsum

  File "einsumfunc.py", line 1356, in einsum
    return c_einsum(*operands, **kwargs)

TypeError: keyword parameter out must be an array for einsum

Numpy/Python version information:

1.18.1 3.7.5 (default, Oct 31 2019, 15:18:51) [MSC v.1916 64 bit (AMD64)]

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
WarrenWeckessercommented, Mar 22, 2020

@eric-wieser, you already fixed this, in https://github.com/numpy/numpy/pull/15256! 😄

Should we add a unit test to ensure it stays fixed?

1reaction
sgassecommented, Mar 22, 2020

Is this still an issue? I can reproduce the bug in an older version like 1.17.2, but not on the latest master:

>>> import numpy as np
>>> np.__version__
'1.19.0.dev0+0b9b176'
>>> np.einsum('i,j',[1],[2],out=None)
array([[2]])
Read more comments on GitHub >

github_iconTop Results From Across the Web

The `out` arguments in `numpy.einsum` can not work as ...
I haven't used this new out parameter before, but have worked with einsum in the past, and have a general idea of how...
Read more >
numpy.einsum — NumPy v1.24 Manual
When there is only one operand, no axes are summed, and no output parameter is provided, a view into the operand is returned...
Read more >
jax._src.numpy.lax_numpy — Objax 1.6.0 documentation
Since NumPy operations are not primitive and instead are implemented in terms of ... not recognize bfloat16, so arrays are serialized as void16...
Read more >
Source code for pytato.array - Index of /
Array: if not isinstance(slice_spec, tuple): slice_spec = (slice_spec,) # FIXME: This doesn't support all NumPy basic indexing constructs, ...
Read more >
NumPy Functions — Descartes Labs public documentation
all (ndarray, bool) – A new boolean or array is returned unless out is ... Reference object to allow the creation of arrays...
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