MCPcopy Create free account
hub / github.com/openai/shap-e / MemoryViewData

Class MemoryViewData

shap_e/rendering/view_data.py:186–206  ·  view source on GitHub ↗

A ViewData that is implemented in memory.

Source from the content-addressed store, hash-verified

184
185
186class MemoryViewData(ViewData):
187 """
188 A ViewData that is implemented in memory.
189 """
190
191 def __init__(self, channels: Dict[str, np.ndarray], cameras: List[Camera]):
192 assert all(v.shape[0] == len(cameras) for v in channels.values())
193 self.channels = channels
194 self.cameras = cameras
195
196 @property
197 def num_views(self) -> int:
198 return len(self.cameras)
199
200 @property
201 def channel_names(self) -> List[str]:
202 return list(self.channels.keys())
203
204 def load_view(self, index: int, channels: List[str]) -> Tuple[Camera, np.ndarray]:
205 outputs = [self.channels[channel][index] for channel in channels]
206 return self.cameras[index], np.stack(outputs, axis=-1)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected