如何在 google colab 中确定 .pth 文件的形状

How to determine shape of .pth file in google colab

我有 abc.pth 文件,它是一个功能文件。我想通过google colab来确定这个文件的shape/dimension。如何加载它并确定它的形状?

path="/path/to/abc.pth"

import torch a=torch.load(path) a.size()

它会输出张量

torch.Size([1, 2048, 19, 29])