首页 > 解决方案 > 替代 `out` 以获得性能?

问题描述

RuntimeError: conj(): functions with out=... arguments don't support 
automatic differentiation, but one of the arguments requires grad.

出现在

torch.conj(x[a:b], out=x[a:b])

问题是,x它很大,并且它的大片被共轭在一个循环中;out=备用分配中间张量(这要慢得多)。

是否有更快、可区分的替代方案x[a:b] = torch.conj(x[a:b])

标签: pythonpytorchautograd

解决方案


推荐阅读