Home 解决RuntimeError: input is not contiguous问题
Post
Cancel

解决RuntimeError: input is not contiguous问题

出现了这个问题是因为tensor在内存中地址不是连续的,因而需要调用.contiguous()方法使得变为连续.

用法:

1
torch.randn(2,2).contiguous()
This post is licensed under CC BY 4.0 by the author.