相关疑难解决方法(0)

How do I flatten a tensor in pytorch?

Given a tensor of multiple dimensions, how do I flatten it so that it has a single dimension?

Eg:

>>> t = torch.rand([2, 3, 5])
>>> t.shape
torch.Size([2, 3, 5])
Run Code Online (Sandbox Code Playgroud)

How do I flatten it to have shape:

torch.Size([30])
Run Code Online (Sandbox Code Playgroud)

pytorch

7
推荐指数
3
解决办法
1万
查看次数

标签 统计

pytorch ×1