rasbt / deeplearning-models

A collection of various deep learning architectures, models, and tips

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Questions on notebook wgan-1.ipynb

SalvishGoomanee opened this issue · comments

Hi,

I am going through the notebook wgan-1.ipynb and upon running the script as is I encounter the following error:

Traceback (most recent call last):
  File "3_wgan.py", line 162, in <module>
    real_loss = wasserstein_loss(valid, disc_pred_real)
  File "3_wgan.py", line 76, in wasserstein_loss
    return torch.mean(y_true * y_pred)
RuntimeError: The size of tensor a (128) must match the size of tensor b (100352) at non-singleton dimension 0

As a result, I updated the line in the discriminator training part to:

real_loss = wasserstein_loss(valid, disc_pred_real[:128])

so that the dimensions match.

However, with the last 96 img, and labels and the dimensions are again unmatched. I am wondering if there could be a better way to approach this?

Thank you