Skip to content

Commit b45e611

Browse files
authored
Change the default value of use_numpy to False when initializing tensor and fix a error. (#333)
1 parent 740c3d8 commit b45e611

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

graph_net/paddle/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ def init_float_tensor(shape, mean, std, min_val, max_val, use_numpy):
226226
return tensor
227227

228228

229-
def replay_tensor(info, use_numpy=True):
229+
def replay_tensor(info, use_numpy=False):
230230
device = info["info"]["device"]
231231
dtype = info["info"]["dtype"]
232232
shape = info["info"]["shape"]
@@ -241,7 +241,8 @@ def replay_tensor(info, use_numpy=True):
241241
return paddle.reshape(info["data"], shape).to(dtype).to(device)
242242
elif dtype in [paddle.int32, paddle.int64, paddle.bool]:
243243
init_dtype = "int32" if dtype == paddle.bool else "int64"
244-
min_val, max_val = 0, 1 if dtype == paddle.bool else min_val, max_val
244+
if dtype == paddle.bool:
245+
min_val, max_val = 0, 1
245246
return (
246247
init_integer_tensor(init_dtype, shape, min_val, max_val, use_numpy)
247248
.to(dtype)

0 commit comments

Comments
 (0)