Skip to content

Is there a way to attach metadata to a layer in a way that is included in the StableHLO export? #8993

Open
@j2kun

Description

@j2kun

❓ Questions and Help

I am looking at a use case where metadata about a trained model's layers needs to be attached to the StableHLO export. I am using exported_program_to_stablehlo

One option I had considered is exporting the data completely separately from exported_program_to_stablehlo (say, by writing some random json to disk), but then I don't know how to connect the written metadata back to the stableHLO export, because the layer names do not appear to be attached to the generated StableHLO ops such.

Another option I tried was to attach the metadata directly to the torch nodes before calling exported_program_to_stablehlo, but I can't figure out how to do so in a way that results in the metadata being exported as MLIR attributes. It would suffice to export the attributes as, e.g., an op attribute with a given string name and value.

Could someone advise on whether this is possible, or suggest an alternative? (Or add a feature that would support this?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions