Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pjessesco/print2d
Replacement of `print()` for printing 2d array with readability including Torch and Numpy.
https://github.com/pjessesco/print2d
formatted-text numpy print python3 readability torch
Last synced: about 1 month ago
JSON representation
Replacement of `print()` for printing 2d array with readability including Torch and Numpy.
- Host: GitHub
- URL: https://github.com/pjessesco/print2d
- Owner: pjessesco
- License: mit
- Created: 2021-03-12T07:02:20.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-03-30T05:30:57.000Z (over 3 years ago)
- Last Synced: 2024-10-02T05:01:31.680Z (about 2 months ago)
- Topics: formatted-text, numpy, print, python3, readability, torch
- Language: Python
- Homepage:
- Size: 21.5 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# print2d : Print 2d array with readability
[![PyPI version](https://badge.fury.io/py/print2d.svg)](https://badge.fury.io/py/print2d)
Replacement of `print()` for printing 2d array with readability.
print2d(mat1, "*" ,mat2, "=", mult)
[[4. 3. 1. 1. ] * [[1 2 3] = [[26. 24. 39. ]
[6. 2. 4. 8. ] [5 2 6] [64. 84. 98. ]
[1.1 6.6 1.5 0.1]] [2 3 1] [37.6 20.6 45.2]]
[5 7 8]]## Available types
- Python `list`
- NumPy `ndarray`
- PyTorch `Tensor`## Install
pip install print2d
## Usage
Import this module
from print2d import *
`print2d()` function gets parameter separated with comma(,).
### Python list
arr1 = [[1,2],[3,4], [5,6]]
arr2 = [[1, 2, 3], [4, 5, 6]]
print2d("arr1", arr1, "arr2", arr2)---
arr1 [[1, 2] arr2 [[1, 2, 3]
[3, 4] [4, 5, 6]]
[5, 6]]### NumPy ndarray
np1 = np.array([[1,2],[3,4], [5,6]])
np2 = np.array([[1, 2, 3], [4, 5, 6]])
print2d("np1", np1, "np2", np2)---
np1 [[1 2] np2 [[1 2 3]
[3 4] [4 5 6]]
[5 6]]### PyTorch Tensor
tc1 = torch.tensor([[1,2],[3,4], [5,6]])
tc2 = torch.tensor([[1, 2, 3], [4, 5, 6]])
print2d("tc1", tc1, "tc2", tc2)---
tc1 tensor([[1, 2], tc2 tensor([[1, 2, 3],
[3, 4], [4, 5, 6]])
[5, 6]])### Combination
arr1 = [[1,2],[3,4], [5,6]]
np2 = np.array([[1, 2, 3], [4, 5, 6]])
print2d("arr1", arr1, "np2", np2)---
arr1 [[1, 2] np2 [[1 2 3]
[3, 4] [4 5 6]]
[5, 6]]