AttributeError: 'tuple' object has no attribute 'permute'
hw-choo opened this issue · 2 comments
Hi there, thanks for sharing your code.
C:\Users\admin\latent_ode_updated\run_models.py
run_models.py --niters 100 -n 8000 -l 20 --dataset physionet --latent-ode --rec-dims 40 --rec-layers 3 --gen-layers 3 --units 50 --gru-units 50 --quantization 0.016 --classif
AttributeError Traceback (most recent call last)
~\latent_ode_updated\run_models.py in
262
263 batch_dict = utils.get_next_batch(data_obj["train_dataloader"])
--> 264 train_res = model.compute_all_losses(batch_dict, n_traj_samples = 3, kl_coef = kl_coef)
265 train_res["loss"].backward()
266 optimizer.step()
~\latent_ode_updated\lib\base_models.py in compute_all_losses(self, batch_dict, n_traj_samples, kl_coef)
257 batch_dict["observed_data"], batch_dict["observed_tp"],
258 mask = batch_dict["observed_mask"], n_traj_samples = n_traj_samples,
--> 259 mode = batch_dict["mode"])
260
261 #print("get_reconstruction done -- computing likelihood")
~\latent_ode_updated\lib\latent_ode.py in get_reconstruction(self, time_steps_to_predict, truth, truth_time_steps, mask, n_traj_samples, run_backwards, mode)
86
87 # Shape of sol_y [n_traj_samples, n_samples, n_timepoints, n_latents]
---> 88 sol_y = self.diffeq_solver(first_point_enc_aug, time_steps_to_predict)
89
90 if self.use_poisson_proc:
~\Anaconda3\envs\gpu-supported\lib\site-packages\torch\nn\modules\module.py in call(self, *input, **kwargs)
487 result = self._slow_forward(*input, **kwargs)
488 else:
--> 489 result = self.forward(*input, **kwargs)
490 for hook in self._forward_hooks.values():
491 hook_result = hook(self, input, result)
~\latent_ode_updated\lib\diffeq_solver.py in forward(self, first_point, time_steps_to_predict, backwards)
40 pred_y = odeint(self.ode_func, first_point, time_steps_to_predict,
41 rtol=self.odeint_rtol, atol=self.odeint_atol, method = self.ode_method)
---> 42 pred_y = pred_y.permute(1,2,0,3)
43
44 assert(torch.mean(pred_y[:, :, 0, :] - first_point) < 0.001)
AttributeError: 'tuple' object has no attribute 'permute'
Just my mistake, sorry. forget it.