ArrayDebug generates human-friendly debug information for array-like objects.
Project description
ArrayDebug
ArrayDebug generates human-friendly debug information for array-like objects.
- Free software: MIT license
- Support python 3.6+
Usage
All you need is to import arraydebug
after numpy
, torch
, pandas
, etc.
>>> import numpy as np
>>> import torch
>>> import pandas as pd
>>> ...
>>> import arraydebug # import at last
Then you will get information of the array-like object shown in the debugger, like:
<Tensor: shape=(6, 4), dtype=float32, device='cpu', requires_grad=True>
It works with all debuggers which rely on repr
function to display variable information.
- VSCode
- IPython
- pdb
- etc.
VSCode
IPython
In [1]: import torch
In [2]: import arraydebug
In [3]: torch.ones(6, 4, requires_grad=True)
Out[3]:
<Tensor: shape=(6, 4), dtype=float32, device='cpu', requires_grad=True>
tensor([[1., 1., 1., 1.],
[1., 1., 1., 1.],
[1., 1., 1., 1.],
[1., 1., 1., 1.],
[1., 1., 1., 1.],
[1., 1., 1., 1.]], requires_grad=True)
pdb
$ python -m pdb examples/example.py
...
...
...
(Pdb) tensor
<Tensor: shape=(6, 4), dtype=float32, device='cpu', requires_grad=True>
tensor([[0.0833, 0.2675, 0.4372, 0.5344],
[0.9977, 0.6844, 0.1404, 0.2646],
[0.7211, 0.7529, 0.1239, 0.2511],
[0.1717, 0.6611, 0.6598, 0.9705],
[0.5230, 0.3439, 0.0459, 0.9937],
[0.8603, 0.6598, 0.0652, 0.1235]], requires_grad=True)
Credits
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
History
0.1.0 (2022-03-27)
- First release on PyPI.
- Support numpy.ndarray, torch.Tensor.
- Support objects with
__array__
method. - Setup github CI workflow.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
arraydebug-0.1.1.tar.gz
(81.7 kB
view hashes)
Built Distribution
Close
Hashes for arraydebug-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 333f848ff70cfe13f6c7913fab3a10103b3f58d409ae382d20660e62e594c9ab |
|
MD5 | 647403a15196fb6efad420608c7e754b |
|
BLAKE2b-256 | 3d1e2942436a5db500b1fadf5889d687f60e38e4415f6ee75a866fab450344ca |