Skip to content

How Do PyTorch Handle Unrolled LSTM Layers from ONNX #244

@kumarutkarsh1248

Description

@kumarutkarsh1248

Image
This above image represents an LSTM block in ONNX

I'm trying to understand how frameworks such as PyTorch and TensorFlow load layers that are stored in an unrolled state in ONNX.

For example, in ONNX, LSTM and RNN models are often represented in an unrolled form, consisting of multiple Linear, Add, and Concat layers. When converting an ONNX model to PyTorch, I have the following questions:

  1. Do these frameworks load the layers in their unrolled form, keeping them as separate operations?

  2. Or do they use a pattern-matching engine to detect LSTM blocks in the ONNX graph?

  3. If such an engine exists, does PyTorch then replace the unrolled structure with a native torch.nn.LSTM layer instead of preserving the individual operations?

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