Skip to content

Instantly share code, notes, and snippets.

@apivovarov
Created August 23, 2024 21:47
Show Gist options
  • Select an option

  • Save apivovarov/bbaf7d595449f3d2f3565e776d1a8d23 to your computer and use it in GitHub Desktop.

Select an option

Save apivovarov/bbaf7d595449f3d2f3565e776d1a8d23 to your computer and use it in GitHub Desktop.

Revisions

  1. apivovarov created this gist Aug 23, 2024.
    7 changes: 7 additions & 0 deletions hlo_convert_torch_xla.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    import torch_xla.core.xla_builder as xb

    fname = "model.hlo.pb"
    with open(fname, mode="rb") as f:
    comp = xb.computation_from_module_proto("foo", f.read())

    print(xb.get_computation_hlo(comp))