chenhsuanlin / inverse-compositional-STN

Inverse Compositional Spatial Transformer Networks :performing_arts: (CVPR 2017 oral)
MIT License
318 stars 63 forks source link

Dataload issue #8

Closed LinChen-Cherry closed 5 years ago

LinChen-Cherry commented 6 years ago

As the PyTorch Implementation uses Tensorflow to load data, I write a class inheriting from torch.utils.data.Dataset, and then use Dataloader to load data. However, I got errors as below:

RuntimeError: Cannot re-initialize CUDA in forked subprocess. To use CUDA with multiprocessing, you must use the 'spawn' start method

I debug this, and found out that "torch.set_default_tensor_type("torch.cuda.FloatTensor")" in options.py causing this issue.

While, when I removed this sentence, I got another error:

File "/home/lin/inverse-compositional-STN/MNIST-pytorch/graph.py", line 156, in initialize m.weight.data.normal_(0,0.0 if last0 and m is model.linearLayers[-1] else stddev) RuntimeError: invalid argument 2: standard deviation must be strictly positive at /pytorch/torch/lib/TH/THRandom.c:255

chenhsuanlin commented 6 years ago

I've updated the weight initialization code, this part should be fixed now. Also I appreciate you pointing out the data loader part :) I wasn't aware I was still calling Tensorflow on this part. I'll fix this as well as the default cuda FloatTensor parts in the near future, so I'm leaving this issue open for now