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 6def9c4 commit 0c792c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/test_fori_loop_simple_linear_model_test_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def body_fun(l_in_i):
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, 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_, 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
3 changes: 2 additions & 1 deletion torch_xla/experimental/fori_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ def body_fn(one_value, lower, upper, x, bias_0, weight_0, *input_value, output_v
return_list.append(bias)
# TODO(@manfei): should initialize weight with torch.nn.linear's real weight, currently we use placeholder for all weight are 1
# weight = torch.ones([20, 10], dtype=torch.float32, device=device) # f32[20,10] # ???
weight = weight_0
# weight = weight_0
weight = body_fun.weight
# return_list.append(weight)
# return_list.insert(-1, weight)
return_list.append(weight)
Expand Down

0 comments on commit 0c792c3

Please sign in to comment.