(self, index)
| 45 | ) |
| 46 | |
| 47 | def __getitem__(self, index): |
| 48 | sample_index, data, motion, motion_path = self._fetch_motion_sample(index) |
| 49 | motion_length = motion.shape[0] |
| 50 | |
| 51 | normalized_motion = self._normalize_motion_tensor(motion) |
| 52 | |
| 53 | data_dict = { |
| 54 | "motion": normalized_motion, |
| 55 | "motion_length": motion_length, |
| 56 | } |
| 57 | motion_dim_mask = torch.ones(self.motion_dim) |
| 58 | |
| 59 | ref_motion_dict, motion_dim_mask, attend_to_text_mask = self._prepare_ref_motion( |
| 60 | data=data, |
| 61 | motion=normalized_motion, |
| 62 | motion_dim_mask=motion_dim_mask, |
| 63 | motion_path=motion_path, |
| 64 | ) |
| 65 | data_dict.update(ref_motion_dict) |
| 66 | |
| 67 | prompt_emb = self._resolve_prompt_embedding(data) |
| 68 | prompt_emb = self._pad_prompt_embedding(prompt_emb) |
| 69 | data_dict["prompt_emb"] = prompt_emb |
| 70 | data_dict["prompt_length"] = prompt_emb.shape[0] |
| 71 | data_dict["prompt_emb_null"] = self.null_context |
| 72 | data_dict["motion_mean"] = self.motion_mean |
| 73 | data_dict["motion_std"] = self.motion_std |
| 74 | data_dict["text"] = data["short_annot"] if "short_annot" in data else "None" |
| 75 | data_dict["motion_dim_mask"] = motion_dim_mask |
| 76 | data_dict["attend_to_text_mask"] = attend_to_text_mask |
| 77 | data_dict["test_sample_id"] = self._resolve_sample_id(data, sample_index) |
| 78 | |
| 79 | return data_dict |
| 80 | |
| 81 | def __len__(self): |
| 82 | return len(self.data_list) |
nothing calls this directly
no test coverage detected