Sparse and dense Tensor repr in Jupyter

Folks using Jupyter might find this handy.

I’m the author of a utility called matrepr · PyPI that can pretty-format sparse and dense tensors to string, HTML, and Latex, with Jupyter integration.

TensorFlow’s native string repr works well for dense tensors, but less so for sparse tensors. MatRepr will pretty-print to a nice 2D matrix, or a coordinates+value tuple if more than 2 dimensions.

See a demo comparing native TensorFlow repr with MatRepr in this Jupyter Notebook

Feedback welcome!

2D Example:

@alugowski , Thanks for contributing!