我正在关注hstack的this文档。
a = torch.tensor([1, 2, 3])
b = torch.tensor([4, 5, 6])
torch.hstack((a,b))但我一直收到错误:
AttributeError: module 'torch' has no attribute 'hstack'以下是导致此错误的torch版本:
torch.__version__
'1.6.0+cpu'我做错了什么?
发布于 2020-10-18 01:23:54
显然,您正在调用的函数在您的PyTorch版本中尚不存在--这就是错误消息的内容。
您的链接指向与开发人员预览相关的帮助页面:注意左上角的.8.0a0+342069f版本号。单击时,单击此处查看最新稳定版本的文档。链接-出现错误消息。
此功能在torch版本的1.8.0.中可用--在此之前,请考虑使用带有‘`dim=1’的torch.cat。
torch.cat([a,b], dim=1) # a, b - 2d torch.Tensorshttps://stackoverflow.com/questions/64405165
复制相似问题