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

TypeError: 'module' object is not callable #2

Open
dreamkily opened this issue Nov 5, 2019 · 5 comments
Open

TypeError: 'module' object is not callable #2

dreamkily opened this issue Nov 5, 2019 · 5 comments

Comments

@dreamkily
Copy link

hi, thanks for your contribution
I have some problem here
Traceback (most recent call last):
File "resnet50_dwt_mec_officehome.py", line 603, in
main()
File "resnet50_dwt_mec_officehome.py", line 600, in main
target_test_loader=target_testloader)
File "resnet50_dwt_mec_officehome.py", line 420, in train_infinite_collect_stats
output = model(data)
File "/home/xing/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "resnet50_dwt_mec_officehome.py", line 336, in forward
x = torch.cat((self.bns1(x_s), torch.cat((self.bnt1(x_t), self.bnt1_aug(x_t_dup)), dim=0) ), dim=0) * self.gamma1 + self.beta1
File "/home/xing/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "resnet50_dwt_mec_officehome.py", line 60, in forward
out = self.wh(x)
File "/home/xing/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "/home/xing/mengzhu/paper_code/dwt-domain-adaptation-master/utils/whitening.py", line 50, in forward
f_cov_shrinked = (1-self.eps) * f_cov + self.eps * torch.eye(self.group_size, out=torch.cuda(2).FloatTensor() if torch.cuda.is_available() else torch.FloatTensor()).repeat(self.num_groups, 1, 1)
TypeError: 'module' object is not callable

@roysubhankar
Copy link
Owner

Hi, if I understand correctly you want to run this code on GPUs id 2 right?

Instead of out = torch.cuda(2), can you please use CUDA_VISIBLE_DEVICES=2 and leave the code unchanged?

@dreamkily
Copy link
Author

thank you very much, it's very helpfulto me

@dreamkily
Copy link
Author

hi roysubhankar! @roysubhankar
there have some problems,can you help me to answer?
Traceback (most recent call last):
File "resnet50_dwt_mec_officehome.py", line 603, in
main()
File "resnet50_dwt_mec_officehome.py", line 600, in main
target_test_loader=target_testloader)
File "resnet50_dwt_mec_officehome.py", line 439, in train_infinite_collect_stats
test(args, model, device, target_test_loader)
File "resnet50_dwt_mec_officehome.py", line 454, in test
output = model(data)
File "/home/xing/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "resnet50_dwt_mec_officehome.py", line 350, in forward
x = self.bnt1(x) * self.gamma1 + self.beta1
File "/home/xing/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "resnet50_dwt_mec_officehome.py", line 60, in forward
out = self.wh(x)
File "/home/xing/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "/home/xing/mengzhu/paper_code/dwt-domain-adaptation-master/utils/whitening.py", line 55, in forward
f_cov_shrinked = (1-self.eps) * self.running_variance + self.eps * torch.eye(self.group_size, out=torch.cuda(2).FloatTensor() if torch.cuda.is_available() else torch.FloatTensor()).repeat(self.num_groups, 1, 1)
TypeError: 'module' object is not callable

@roysubhankar
Copy link
Owner

hi roysubhankar! @roysubhankar
there have some problems,can you help me to answer?
Traceback (most recent call last):
File "resnet50_dwt_mec_officehome.py", line 603, in
main()
File "resnet50_dwt_mec_officehome.py", line 600, in main
target_test_loader=target_testloader)
File "resnet50_dwt_mec_officehome.py", line 439, in train_infinite_collect_stats
test(args, model, device, target_test_loader)
File "resnet50_dwt_mec_officehome.py", line 454, in test
output = model(data)
File "/home/xing/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "resnet50_dwt_mec_officehome.py", line 350, in forward
x = self.bnt1(x) * self.gamma1 + self.beta1
File "/home/xing/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "resnet50_dwt_mec_officehome.py", line 60, in forward
out = self.wh(x)
File "/home/xing/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "/home/xing/mengzhu/paper_code/dwt-domain-adaptation-master/utils/whitening.py", line 55, in forward
f_cov_shrinked = (1-self.eps) * self.running_variance + self.eps * torch.eye(self.group_size, out=torch.cuda(2).FloatTensor() if torch.cuda.is_available() else torch.FloatTensor()).repeat(self.num_groups, 1, 1)
TypeError: 'module' object is not callable

Please change torch.cuda(2) to torch.cuda() in your line

f_cov_shrinked = (1-self.eps) * self.running_variance + self.eps * torch.eye(self.group_size, out=torch.cuda(2).FloatTensor() if torch.cuda.is_available() else torch.FloatTensor()).repeat(self.num_groups, 1, 1)

An easy way to run the code is to keep the default settings and put CUDA_VISIBLE_DEVICES=2 for example if you are running your code in gpu:2

@dreamkily
Copy link
Author

thank you very much,and it help me to solve this problem

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