首页 > 解决方案 > 已经支持 autograd 的复杂函数 - Pytorch

问题描述

我正在使用这个自定义函数在自定义损失函数中重塑我的张量。

def reshape_fortran(x, shape):
if len(x.shape) > 0:
    x = x.permute(*reversed(range(len(x.shape))))
return x.reshape(*reversed(shape)).permute(*reversed(range(len(shape))))

虽然,我收到此错误:

RuntimeError: _unsafe_view does not support automatic differentiation for outputs with complex dtype.

用于reshape_fortran输出。

你知道可能是什么问题吗?Pytorch autograd 不支持哪个函数用于复数?

标签: pythonpytorchreshapecomplex-numbers

解决方案


Complex Autograd 在 1.8 版中处于 Beta 版,但现在已经稳定,应该完全支持1.9版的此类操作。


推荐阅读