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

AttributeError: 'numpy.int64' object has no attribute 'read' #279

Open
muradali4442 opened this issue Aug 9, 2022 · 0 comments
Open

AttributeError: 'numpy.int64' object has no attribute 'read' #279

muradali4442 opened this issue Aug 9, 2022 · 0 comments

Comments

@muradali4442
Copy link

I am running a python code on jupyter notebook and encounter the error "AttributeError: 'numpy.int64' object has no attribute 'read'". I have already searched it a lot but there is nothing available related to "read". I am attaching the code and the SS of the error. Anyone who can help will be really appreciated.

model = models.resnet18(pretrained = True)
num_ftrs = model.fc.in_features
model.fc = nn.Linear(num_ftrs, 2)
model.load_state_dict(torch.load('2_stage_model.pt'))
model.eval()
classes = ('Flowers', 'No_Flowers')
class_probs = []
class_preds = []

with torch.no_grad():
for data in testloader:
images = data
output = model(images)
images = data
output = model(images)
class_probs_batch = [F.softmax(el, dim=0) for el in output]
_, class_preds_batch = torch.max(output, 1)
SS_numpy int64

    class_probs.append(class_probs_batch)
    class_preds.append(class_preds_batch)

test_probs = torch.cat([torch.stack(batch) for batch in class_probs])
test_preds = torch.cat(class_preds)

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

1 participant