Pytorch model weight type conversion
I'm trying to do inference on FlowNet2-C model loading from file.
However, I met some data type problem.  How can I resolve it?


Source code 
FlowNet2-C pre-trained model


$ python main.py

Initializing Datasets
  [0.000s] Loading checkpoint '/notebooks/data/model/FlowNet2-C_checkpoint.pth.tar'
  [1.293s] Loaded checkpoint '/notebooks/data/model/FlowNet2-C_checkpoint.pth.tar' (at epoch 0)
(1L, 6L, 384L, 512L)
&lt;class 'torch.autograd.variable.Variable'&gt;
  [1.642s] Operation failed


Traceback (most recent call last):
  File "main.py", line 102, in &lt;module&gt;
    main()
  File "main.py", line 98, in main
    summary(input_size, model)
  File "main.py", line 61, in summary
    model(x)
  File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 357, in __call__
    result = self.forward(*input, **kwargs)
  File "/notebooks/data/vinet/FlowNetC.py", line 75, in forward
    out_conv1a = self.conv1(x1)
  File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 357, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/container.py", line 67, in forward
    input = module(input)
  File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/module.py", line 357, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/torch/nn/modules/conv.py", line 282, in forward
    self.padding, self.dilation, self.groups)
  File "/usr/local/lib/python2.7/dist-packages/torch/nn/functional.py", line 90, in conv2d
    return f(input, weight, bias)
RuntimeError: Input type (CUDAFloatTensor) and weight type (CPUFloatTensor) should be the same


Maybe that is because your model and input x to the model has different data types. It seems that the model parameters have been moved to GPU, but your input x is on GPU. 

You can try to use model.cuda() after line 94, which will put the model on the GPU. Then the error should disappear.
