MCPcopy Create free account
hub / github.com/MotrixLab/ViMoGen / load_motion_tensor

Function load_motion_tensor

scripts/organize_mbench_results.py:51–63  ·  view source on GitHub ↗

Load and validate motion tensor from a .pt file.

(path: Path)

Source from the content-addressed store, hash-verified

49
50
51def load_motion_tensor(path: Path) -> torch.Tensor:
52 """Load and validate motion tensor from a .pt file."""
53 data = torch.load(path, map_location="cpu")
54 if isinstance(data, dict):
55 if "motion" in data:
56 data = data["motion"]
57 else:
58 raise ValueError(f"{path} contains a dict but no 'motion' field.")
59 if not torch.is_tensor(data):
60 data = torch.as_tensor(data)
61 if data.ndim != 2:
62 raise ValueError(f"Expected a 2D motion tensor in {path}, got shape {tuple(data.shape)}")
63 return data.float()
64
65
66def convert_motion_to_joints(motion_tensor: torch.Tensor) -> np.ndarray:

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected