from typing import Any
import torch


def listify_tensors(params: Any) -> Any:
    """Iterate over an object dictionary, turning any tensors into list representations."""
    for field in params.__dict__:
        attr = getattr(params, field)
        if isinstance(attr, torch.Tensor):
            setattr(params, field, attr.tolist())
    return params