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

'Tensor' object is not callable #11

Open
youyeg opened this issue Jan 9, 2019 · 1 comment
Open

'Tensor' object is not callable #11

youyeg opened this issue Jan 9, 2019 · 1 comment

Comments

@youyeg
Copy link

youyeg commented Jan 9, 2019

I modified the code, and I get an error, does anybody have any idea why?
I am using CPU:

I have an error in this line:

—> 10 output_teacher_batch = teacher_model(data_batch).data().numpy()
TypeError: ‘Tensor’ object is not callable

Does anybody have an idea how to solve this?

def fetch_teacher_outputs(teacher_model, dataloader):

set teacher_model to evaluation mode

teacher_model.eval()
teacher_outputs = []
for i, (data_batch, labels_batch) in enumerate(dataloader):
if torch.cuda.is_available():
data_batch, labels_batch = data_batch.cuda(async=True),
labels_batch.cuda(async=True)
data_batch, labels_batch = Variable(data_batch), Variable(labels_batch)

**output_teacher_batch = teacher_model(data_batch).data().numpy()**
teacher_outputs.append(output_teacher_batch)

return teacher_outputs

@haitongli
Copy link
Owner

Hi, could you be more specific about where and what you modified? What you pasted here is not easy to read.

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