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

Function append_dims

point_e/diffusion/k_diffusion.py:323–328  ·  view source on GitHub ↗

Appends dimensions to the end of a tensor until it has target_dims dimensions.

(x, target_dims)

Source from the content-addressed store, hash-verified

321
322
323def append_dims(x, target_dims):
324 """Appends dimensions to the end of a tensor until it has target_dims dimensions."""
325 dims_to_append = target_dims - x.ndim
326 if dims_to_append < 0:
327 raise ValueError(f"input has {x.ndim} dims but target_dims is {target_dims}, which is less")
328 return x[(...,) + (None,) * dims_to_append]
329
330
331def append_zero(x):

Callers 4

training_lossesMethod · 0.85
denoiseMethod · 0.85
denoiseMethod · 0.85
to_dFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected