Skip to content

Infinit Recursion in torchlens.log_forward_pass() #39

@DirkKeller

Description

@DirkKeller

Hi all,

First off, thanks for the amazing visualization library! I was excited to try it out, but I encountered an infinite recursion error when calling torchlens.log_forward_pass(). I tested this using the AlexNet example from your Colab notebook, both on Colab and my local computer.

Example:
model = torchvision.models.AlexNet()
x = torch.rand(1, 3, 224, 224)

model_history = tl.log_forward_pass(model, x, vis_opt='unrolled')
print(model_history)

Error:
Fatal Python error: Cannot recover from stack overflow.
Python runtime state: initialized

The error trace shows repeated calls to functions in torchlens.helper_funcs.py, particularly:

extend_search_stack_from_item
search_stack_for_vars_of_type
get_vars_of_type_from_obj
log_function_output_tensors_exhaustive

These functions seem to be recursively calling each other indefinitely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions