请问HN:你们是如何可视化张量的?

1作者: HardikVala大约 1 个月前原帖
我常常需要打印原始张量(无论是手动打印还是输出到标准输出),特别是在阅读 PyTorch 或 JAX 代码时,以便理解数据的变换。例如,对于以下代码: `x = torch.randn(32, 3, 224, 224).unfold(2, 16, 16).unfold(3, 16, 16).reshape(32, 3, 196, 256).transpose(1, 2).reshape(32, 196, 768).view(32, 196, 12, 64).transpose(1, 2)` 大家是如何可视化张量的,以便快速理解复杂神经网络中的数据流动的呢?
查看原文
I constantly find myself having to print raw tensors (either by hand or dumping them to stdout), especially when reading pytorch &#x2F; jax code, to understand the transformations, e.g. for something like,<p>`x = torch.randn(32, 3, 224, 224).unfold(2, 16, 16).unfold(3, 16, 16).reshape(32, 3, 196, 256).transpose(1, 2).reshape(32, 196, 768).view(32, 196, 12, 64).transpose(1, 2)`<p>How do folks visualize tensors to quickly understand data flow in complex NN&#x27;s?