Skip to content

Type erorr about torch.FloatTensor and torch.cuda.FloatTensor #3

@zhouhongh

Description

@zhouhongh

Hi:
I followed your instructions in readme,but I got the following error:
Traceback (most recent call last):
File "test_refine_w_mask_two_path.py", line 149, in
a.test()
File "test_refine_w_mask_two_path.py", line 124, in test
y_pred_before_refine, y_pred, mu, logvar, flow, flowback, mask_fw, mask_bw = vae(frame1, data, bg_mask, fg_mask, noise_bg, z_m)
File "/home/zhouhh/anaconda3/envs/python35/lib/python3.5/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/home/zhouhh/seg2vid/src/models/multiframe_w_mask_genmask_two_path.py", line 254, in forward
enco1, enco2, enco3, codex = self.encoder(input).cuda()
File "/home/zhouhh/anaconda3/envs/python35/lib/python3.5/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/home/zhouhh/seg2vid/src/models/multiframe_w_mask_genmask_two_path.py", line 157, in forward
enco1 = self.econv1(x) # 32
File "/home/zhouhh/anaconda3/envs/python35/lib/python3.5/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/home/zhouhh/seg2vid/src/models/multiframe_w_mask_genmask_two_path.py", line 91, in forward
return self.main(x)
File "/home/zhouhh/anaconda3/envs/python35/lib/python3.5/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/home/zhouhh/anaconda3/envs/python35/lib/python3.5/site-packages/torch/nn/modules/container.py", line 91, in forward
input = module(input)
File "/home/zhouhh/anaconda3/envs/python35/lib/python3.5/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/home/zhouhh/anaconda3/envs/python35/lib/python3.5/site-packages/torch/nn/modules/conv.py", line 301, in forward
self.padding, self.dilation, self.groups)
RuntimeError: Expected object of type torch.FloatTensor but found type torch.cuda.FloatTensor for argument #2 'weight'
Could you give me some advices?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions