MCPcopy Create free account
hub / github.com/openai/point-e / model_fn

Method model_fn

point_e/diffusion/sampler.py:195–203  ·  view source on GitHub ↗
(x_t, ts, **kwargs)

Source from the content-addressed store, hash-verified

193 self, model: Callable[..., torch.Tensor], scale: float
194 ) -> Callable[..., torch.Tensor]:
195 def model_fn(x_t, ts, **kwargs):
196 half = x_t[: len(x_t) // 2]
197 combined = torch.cat([half, half], dim=0)
198 model_out = model(combined, ts, **kwargs)
199 eps, rest = model_out[:, :3], model_out[:, 3:]
200 cond_eps, uncond_eps = torch.chunk(eps, 2, dim=0)
201 half_eps = uncond_eps + scale * (cond_eps - uncond_eps)
202 eps = torch.cat([half_eps, half_eps], dim=0)
203 return torch.cat([eps, rest], dim=1)
204
205 return model_fn
206

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected