yegane:

output_teacher_batch = teacher_model(data_batch).data().numpy()


data is an attribute of the returned tensor object and not a function. Instead of this, you should probably have: output_teacher_batch = teacher_model(data_batch).data.numpy()