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.

Printing error message for huge ChainerX array blocks REPL

See original GitHub issue

When the type of function’s argument is incompatible, chainerx tries to show TypeError with the details of the invoked array X in the Invoked with: section. If the X is huge, ChainerX still shows all data contained in X. It takes much time and blocks REPL.

>>> import chainerx as chx
>>> X = chx.arange(10000000)  # huge data
>>> x = X.take([0], axis=1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: take(): incompatible function arguments. The following argument types are supported:
    1. (self: chainerx.ndarray, indices: chainerx.ndarray, axis: Optional[int]=None) -> chainerx.ndarray

Invoked with: array([[0., 0.],
       [0., 0.]], shape=(2, 2), dtype=float64, device='cuda:0'), [0]; kwargs: axis=1

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
beam2dcommented, Dec 20, 2018

Thanks for the catch! The message is auto-generated by pybind11, so there are two options.

  1. Switch to a custom type error message in which the whole array repr is not printed.
  2. Fix __repr__ to omit middle items when the array is too large.

I’m not sure if we can accomplish the option 1 (I think we should anyway have a way to customize it, though…). The option 2 is anyway needed for other places. We can follow the format used in NumPy, whose __repr__ also omits middle items of large arrays.

0reactions
okapiescommented, Jun 25, 2019

It is still a problem in invoking such as .reshape(-1).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Abbreviate output of `chainerx::ArrayRepr` for large inputs by ...
Successfully merging this pull request may close these issues. Abbreviate output of str() for large ChainerX arrays Printing error message for huge ......
Read more >
Terminal Printing Error - Replit
I've been having a problem where the terminal seems to print lines to the bottom right rather than directly below itself. The repl...
Read more >
Chainer Documentation - Read the Docs
As per the warning above, the forward_cpu() method returns a tuple of single element. Note that all arrays appearing.
Read more >
chainerx.squared_error — Chainer 7.8.1 documentation
Can be used to compute mean squared error by just calling mean() on the output array. Parameters. x0 (ndarray) – Input variable.
Read more >
Swift: Google's Bet on Differentiable Programming
AIUI they hired another huge contributor to LLVM/Clang/Swift to work ... the only problems are 1) its focus is it being used from...
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