Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EBGAN.py give error raise TypeError('iteration over a 0-d tensor') TypeError: iteration over a 0-d tensor #10

Open
pankajbadatia opened this issue Apr 25, 2018 · 1 comment

Comments

@pankajbadatia
Copy link

pankajbadatia commented Apr 25, 2018

if list(self.margin-D_fake_err.data)[0] > 0: D_loss = D_real_err + (self.margin - D_fake_err) else: D_loss = D_real_err self.train_hist['D_loss'].append(D_loss.data[0])

The error is in the above line no 190 .... Below Code worked for me .. am i Correct ? I removed word list and [0]
if (self.margin-D_fake_err.data) > 0: D_loss = D_real_err + (self.margin - D_fake_err) else: D_loss = D_real_err self.train_hist['D_loss'].append(D_loss.data[0])

@jmmcd
Copy link

jmmcd commented May 23, 2018

I think this is the same error I saw, due to an update in the pytorch API. The suggested change is to replace .data[0] with .data.item(). My pull request has this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants