Skip to content

get_kernel_size has a bug #355

@tiandiweizun

Description

@tiandiweizun

Describe the bug
get_nernel_size raise a TypeError: iteration over a 0-d tensor, when the k(kernel_size) is a tensor with only one item。

To Reproduce

#pip install torchinfo ==1.8.0
#pip install transformers == 4.49.0
from torchinfo import summary
from transformers import MimiModel 

summary(MimiModel.from_pretrained("kyutai/mimi"), input_size=(1,1,32000))

Expected behavior
show the model structure

Screenshots

Image

Desktop (please complete the following information):

  • OS: ubuntu 22.04

Additional context
When k is a tensor with only one item, it is also Iterable

            if isinstance(k, Iterable):
                kernel_size = list(k)

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