How does one log RAM usage during training? Does gc also include RAM usage? For instance, does the following code correctly log RAM usage?
    for obj in gc.get_objects():
        try:
            if torch.is_tensor(obj) or (hasattr(obj, 'data') and torch.is_tensor(obj.data)):
                print(type(obj), obj.size())
        except:
            pass