https://github.com/GPflow/GPflow
Raw File
Tip revision: 2b0999ebc4d6e81c567fd9d0f7b3d78c1b8fd136 authored by frgsimpson on 29 June 2022, 15:38:42 UTC
Adjust sgpr to support likelihood variance in vector form
Tip revision: 2b0999e
debugger.py
import inspect

ENABLE = False
SHAPE_ONLY = False


def print_locals(stack_index: int = 1) -> None:
    if not ENABLE:
        return

    stack = inspect.stack()
    frame_info = stack[stack_index]
    frame = frame_info.frame
    print("**************************************************")
    print("Locals of:", frame.f_code.co_name)
    print("**************************************************")

    sentinel = object()
    for name, value in frame.f_locals.items():
        if SHAPE_ONLY:
            shape = getattr(value, "shape", sentinel)
            if shape is not sentinel:
                value = shape
        print(name, value)
back to top