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: torch.FloatTensor is not a Module subclass #1

Open
qingfengmingyue opened this issue Sep 19, 2019 · 2 comments
Open

TypeError: torch.FloatTensor is not a Module subclass #1

qingfengmingyue opened this issue Sep 19, 2019 · 2 comments

Comments

@qingfengmingyue
Copy link

Traceback (most recent call last):
File "train.py", line 2, in
main(mode=1)
File "/root/edge-informed-sisr/main.py", line 42, in main
model = EdgeMatch(config)
File "/root/edge-informed-sisr/src/edge_match.py", line 27, in init
self.sr_model = SRModel(config).to(config.DEVICE)
File "/root/edge-informed-sisr/src/models.py", line 179, in init
self.add_module('scale_kernel', kernel_weight)
File "/root/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 179, in add_module
torch.typename(module)))
TypeError: torch.FloatTensor is not a Module subclass

@Dayananda-V
Copy link

@qingfengmingyue

i found the working fix, please add the below code will fix this problem(just comment the add_module for scale_kernel instead create scale_kernel variable).

#self.add_module('scale_kernel', kernel_weight) self.scale_kernel = torch.tensor(np.tile(kernel, (3, 1, 1, 1))).float()

@jsjs0827
Copy link

jsjs0827 commented Nov 7, 2019

@Dayananda-V Can you show the result? I just figure out the mosaic.

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

3 participants