我的python函数返回的是 tensor([102],cuda::0) 样的结构。我如何从中获取第一个值?
tensor([102],cuda::0)
发现这个 pytorch论坛:
a.data.cpu().numpy()[0]
其中 a 是张量。
a