【发布时间】:2021-04-30 03:56:09
【问题描述】:
使用广播的 pytorch 操作消耗的内存是否比扩展少?比如下面两个程序在内存使用上是不同的吗?
import torch
x = torch.randn(20,1)
y = torch.randn(1,20)
z = x*y
import torch
x = torch.randn(20,1).expand(-1,20)
y = torch.randn(1,20).expand(20,-1)
z = x*y
【问题讨论】:
标签: python numpy pytorch array-broadcasting