johnmarktaylor91 / torchlens

Package for extracting and mapping the results of every single tensor operation in a PyTorch model in one line of code.
GNU General Public License v3.0
487 stars 17 forks source link

The output layer is equal to Linear layer, however it should not to be #30

Closed whisperLiang closed 2 months ago

whisperLiang commented 2 months ago

image

Here is the code:

import torch import torchvision import torchlens as tl

model = torchvision.models.alexnet(pretrained=True) x = torch.rand(1, 3, 224, 224) model_history = tl.log_forward_pass(model, x, vis_opt='unrolled', save_function_args=True) layer_list = model_history.layer_list print(layer_list[-1]) print(model_history)

johnmarktaylor91 commented 2 months ago

In TorchLens the output layer is always just a copy of the final layer. So it should indeed be the same.

whisperLiang commented 2 months ago

Ok, thanks!