You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-4Lines changed: 17 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
# Tensor Sensor
2
2
3
-
<img src="https://explained.ai/tensor-sensor/images/teaser.png" width="50%" align="right">One of the biggest challenges when writing code to implement deep learning networks, particularly for us newbies, is getting all of the tensor (matrix and vector) dimensions to line up properly. It's really easy to lose track of tensor dimensionality in complicated expressions involving multiple tensors and tensor operations. Even when just feeding data into predefined [Tensorflow](https://www.tensorflow.org/) network layers, we still need to get the dimensions right. When you ask for improper computations, you're going to run into some less than helpful exception messages. To help myself and other programmers debug tensor code, I built this library. TensorSensor clarifies exceptions by augmenting messages and visualizing Python code to indicate the shape of tensor variables (see figure to the right for a teaser). It works with [Tensorflow](https://www.tensorflow.org/), [PyTorch](https://pytorch.org/), and [Numpy](https://numpy.org/), as well as higher-level libraries like [Keras](https://keras.io/) and [fastai](https://www.fast.ai/).
3
+
<imgsrc="https://explained.ai/tensor-sensor/images/teaser.png"width="50%"align="right">One of the biggest challenges when writing code to implement deep learning networks, particularly for us newbies, is getting all of the tensor (matrix and vector) dimensions to line up properly. It's really easy to lose track of tensor dimensionality in complicated expressions involving multiple tensors and tensor operations. Even when just feeding data into predefined [Tensorflow](https://www.tensorflow.org/) network layers, we still need to get the dimensions right. When you ask for improper computations, you're going to run into some less than helpful exception messages.
4
+
5
+
To help myself and other programmers debug tensor code, I built this library. TensorSensor clarifies exceptions by augmenting messages and visualizing Python code to indicate the shape of tensor variables (see figure to the right for a teaser). It works with [Tensorflow](https://www.tensorflow.org/), [PyTorch](https://pytorch.org/), [JAX](https://github.com/google/jax), and [Numpy](https://numpy.org/), as well as higher-level libraries like [Keras](https://keras.io/) and [fastai](https://www.fast.ai/).
4
6
5
7
Please read the complete description in article [Clarifying exceptions and visualizing tensor operations in deep learning code](https://explained.ai/tensor-sensor/index.html).
6
8
@@ -35,14 +37,24 @@ TensorSensor augments the message with more information about which operator cau
35
37
Cause: @ on tensor operand W w/shape [764, 100] and operand X.T w/shape [764, 200]
36
38
```
37
39
40
+
You can also get the full computation graph for an expression that includes all of these sub result shapes.
which gives you module `tsensor`. I developed and tested with the following versions
@@ -56,6 +68,9 @@ numpy 1.18.5
56
68
numpydoc 1.1.0
57
69
$ pip list | grep -i torch
58
70
torch 1.6.0
71
+
$ pip list | grep -i jax
72
+
jax 0.2.6
73
+
jaxlib 0.1.57
59
74
```
60
75
61
76
### Graphviz for tsensor.astviz()
@@ -115,5 +130,3 @@ $ pip install .
115
130
### TODO
116
131
117
132
* can i call pyviz in debugger?
118
-
* try on real examples
119
-
*`dict(W=[3,0,1,2], b=[1,0])` that would indicate (300, 30, 60, 3) would best be displayed as (30,60,3, 300) and b would be first dimension last and last dimension first
0 commit comments