Skip to content

Commit

Permalink
down into cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
ManfeiBai committed Apr 24, 2024
1 parent 9cbdb40 commit 5b8fcb7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions torch_xla/experimental/fori_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ def _xla_while_loop(cond_fn, body_fn, carried_inputs, additional_inputs=None):
cond_hlo = cond_ctx.hlo()
cond_computation = xb.computation_from_module_proto("condcomputation",
cond_hlo)
cond_hlo_print = xb.get_computation_hlo(cond_computation)
print("cond computation: !!!!!!!!!")
print(cond_hlo_print)
# cond_hlo_print = xb.get_computation_hlo(cond_computation)
# print("cond computation: !!!!!!!!!")
# print(cond_hlo_print)

# generate body_fn xlacomputation
body_result = body_fn(*fake_carried_inputs)
Expand All @@ -192,9 +192,9 @@ def _xla_while_loop(cond_fn, body_fn, carried_inputs, additional_inputs=None):
body_hlo = body_ctx.hlo()
body_computation = xb.computation_from_module_proto("bodycomputation",
body_hlo)
body_hlo_print = xb.get_computation_hlo(body_computation)
print("body computation: !!!!!!!!!")
print(body_hlo_print)
# body_hlo_print = xb.get_computation_hlo(body_computation)
# print("body computation: !!!!!!!!!")
# print(body_hlo_print)

# trans fake_carried_inputs from list(tensor) to list(xla::op), which part could change init of xla::while
total_inputs = carried_inputs + additional_inputs
Expand Down Expand Up @@ -223,9 +223,9 @@ def _xla_while_loop(cond_fn, body_fn, carried_inputs, additional_inputs=None):
body_computation=body_computation)
name = 'fori_loop_ed_torch_func'
computation = w.build(name)
hlo_print = xb.get_computation_hlo(computation)
print("while computation: !!!!!!!!!")
print(hlo_print)
# hlo_print = xb.get_computation_hlo(computation)
# print("while computation: !!!!!!!!!")
# print(hlo_print)

# gain final result with generated while xlacomputation
result = torch_xla._XLAC._xla_user_computation('xla::_op_test_while',
Expand Down

0 comments on commit 5b8fcb7

Please sign in to comment.