pytorch-3d-point-cloud-generation icon indicating copy to clipboard operation
pytorch-3d-point-cloud-generation copied to clipboard

Encounter a runtime error when trying to run train_stg1.py

Open C-H-Chien opened this issue 2 years ago • 1 comments

Hi, I am very new to this repo and when I tried to run train_stg1.py, the following runtime error occurs and I am a bit puzzled of the reason why:

======= TRAINING START ======= Epoch 0: Traceback (most recent call last): File "../train_stg1.py", line 45, in hist = trainer.train(model, optimizer, scheduler) File "/pytorch-3d-point-cloud-generation/trainer.py", line 31, in train train_epoch_loss = self._train_on_epoch(model, optimizer) File "/pytorch-3d-point-cloud-generation/trainer.py", line 76, in _train_on_epoch XYZ, maskLogit = model(input_images) File "/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "/pytorch-3d-point-cloud-generation/PCGModel.py", line 123, in forward latent = self.encoder(x) File "/lib/python3.8/site-packages/torch/nn/modules/module.py", line 727, in _call_impl result = self.forward(*input, **kwargs) File "/pytorch-3d-point-cloud-generation/PCGModel.py", line 66, in forward x = self.fc1(x.view(-1, 4096)) RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.

In addition, the user is required to create a logs folder under scripts folder such that a log file can be created automatically before training. I suggest including this information in the README.

Thanks!

C-H-Chien avatar May 04 '22 01:05 C-H-Chien

Okay, it turns out that there exists a difference in how the tensor is stored in memory now. I solve that by either reshaping or add .contiguous() before .view(-1, 4096).

C-H-Chien avatar May 04 '22 01:05 C-H-Chien