def _get_layout(name):
    """Get layout extension object from its string representation."""
    cache = _get_layout.cache  # type: ignore[attr-defined]
    if not cache:
        for v in torch.__dict__.values():
            if isinstance(v, torch.layout):
                cache[str(v)] = v
    return cache[name]
Get layout extension object from its string representation.
deepnvme/model_checkpoint/torch/serialization_orig_v2.6.0.py