Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
ManfeiBai committed Apr 10, 2024
1 parent dcc0103 commit 6def9c4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/test_fori_loop_simple_linear_model_test_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def body_fun(l_in_i):
# TODO(@manfei), need to create new variable to seperate old/formal HLO/IR
l_in_0 = torch.randn(10, device=xm.xla_device())

print("body_fun.weight: ", body_fun.weight)
print("body_fun.weight_: ", body_fun.weight_)
# print("body_fun.weight: ", body_fun.weight)
# print("body_fun.weight_: ", body_fun.weight_)
# def body_fun(x, y, l_in):
# # l_in = torch.randn(10, device=xm.xla_device())
# linear = torch.nn.Linear(10, 20).to(xm.xla_device())
Expand All @@ -70,7 +70,7 @@ def body_fun(l_in_i):

# placeholder_func = torch.rand(size = l_out.size(), device = device)
# placeholder_input = torch.rand(size = l_in_i.size(), device = device)
print("test code, body_fun: ", body_fun)
# print("test code, body_fun: ", body_fun)

# out:
# (upper, lower, !!!one_value, !!!torch.add_res, l_out, weight, final_one)
Expand All @@ -80,7 +80,8 @@ def body_fun(l_in_i):
# one_value_, upper_, lower_, add_res_x_, bias_, weight_, l_in_i_plus_1_, l_out_= fori_loop(upper, lower, body_fun, one_value, init_val, l_in_0) # , placeholder_func, placeholder_input) # , linear_0, l_in_0)
weight_0 =linear_0.weight
bias_0 = linear_0.bias
one_value_, lower_, upper_, add_res_x_, bias_, weight_, l_in_i_plus_1_, l_out_= fori_loop(one_value, lower, upper, body_fun, init_val, l_in_0, weight_0=weight_0, bias_0=bias_0) # , placeholder_func, placeholder_input) # , linear_0, l_in_0)
# one_value_, lower_, upper_, add_res_x_, bias_, weight_, l_in_i_plus_1_, l_out_= fori_loop(one_value, lower, upper, body_fun, init_val, l_in_0, weight_0=weight_0, bias_0=bias_0) # , placeholder_func, placeholder_input) # , linear_0, l_in_0)
one_value_, lower_, upper_, add_res_x_, bias_, weight_, l_in_i_plus_1_, l_out_= fori_loop(one_value, lower, upper, linear_0, init_val, l_in_0, weight_0=weight_0, bias_0=bias_0) # , placeholder_func, placeholder_input) # , linear_0, l_in_0)
#one_value, [upper],[lower],x, [bias],[new_weight], [l_in_i+1], l_out

print("one_value_: ", one_value_)
Expand Down

0 comments on commit 6def9c4

Please sign in to comment.