(path: Path)
| 37 | |
| 38 | |
| 39 | def load_motion_tensor(path: Path) -> torch.Tensor: |
| 40 | data = torch.load(path, map_location="cpu") |
| 41 | if isinstance(data, dict): |
| 42 | if "motion" in data: |
| 43 | data = data["motion"] |
| 44 | else: |
| 45 | raise ValueError(f"{path} contains a dict but no 'motion' field.") |
| 46 | if not torch.is_tensor(data): |
| 47 | data = torch.as_tensor(data) |
| 48 | if data.ndim != 2: |
| 49 | raise ValueError(f"Expected a 2D motion tensor in {path}, got shape {tuple(data.shape)}") |
| 50 | return data.float() |
| 51 | |
| 52 | |
| 53 | def run_smplx( |
no outgoing calls
no test coverage detected