MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / append_dims

Function append_dims

sat/vae_modules/utils.py:270–275  ·  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

268
269
270def append_dims(x, target_dims):
271 """Appends dimensions to the end of a tensor until it has target_dims dimensions."""
272 dims_to_append = target_dims - x.ndim
273 if dims_to_append < 0:
274 raise ValueError(f"input has {x.ndim} dims but target_dims is {target_dims}, which is less")
275 return x[(...,) + (None,) * dims_to_append]
276
277
278def load_model_from_config(config, ckpt, verbose=True, freeze=True):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected