更新时间:2023-12-02 18:54:04
在pytorch中构建 nn.Module
时, pytorch处理1D信号时,实际上希望输入是2D:第一个维度是小批量维度。
因此,您需要在 X $中添加单例维度。 c $ c>:
When you build a nn.Module
in pytorch for processing 1D signals, pytorch actually expects the input to be 2D: first dimension is the "mini batch" dimension.
Thus you need to add a singleton dimesion to your X
:
x_sample, z_mu, z_var = vae(X[None, ...])