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

NameError: name 'long' is not defined #1

Open
pengchengma opened this issue Aug 28, 2017 · 3 comments
Open

NameError: name 'long' is not defined #1

pengchengma opened this issue Aug 28, 2017 · 3 comments

Comments

@pengchengma
Copy link

When I run this program , an error occurs:

"NameError: name 'long' is not defined"

it points to line 11 of file focalloss.py:

if isinstance(alpha,(float,int,long)): self.alpha = torch.Tensor([alpha,1-alpha])

@clcarwin
Copy link
Owner

The code work in python2, python3 do not has long type. You can delete all code lines include "alpha". I will rewrite code include "alpha" these days. It is not as same as the paper.
Thanks.

@Songxinlei
Copy link

what is updated code?

@snoop2head
Copy link

I just deleted the long argument from isinstance() which still works!

Instead of if isinstance(alpha,(float,int,long)): self.alpha = torch.Tensor([alpha,1-alpha]),

I used if isinstance(alpha,(float,int)): self.alpha = torch.Tensor([alpha,1-alpha])

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

4 participants