Skip to content

Pytorch vmap limitation #1031

Closed
Closed
@Ch0ronomato

Description

@Ch0ronomato

Description

If you call .item() (or inadvertently call .item()) in torch, vmap will fail. This means supporting things like scalarloop are difficult when having anything vmap

for i in steps: <--- this calls .item()

The error in question

RuntimeError: vmap: It looks like you're calling .item() on a Tensor. We don't support vmap over calling .item() on a Tensor, please try to rewrite what you're doing with other operations. If error is occurring somewhere inside PyTorch internals, please file a bug report.

pytorch documentation: https://pytorch.org/functorch/stable/ux_limitations.html#data-dependent-operations-item

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions