Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions graph_net/paddle/test_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,23 @@ def test_single_model(args):
compiled_duration_box = DurationBox(-1)
with naive_timer(compiled_duration_box, synchronizer_func):
compiled_out = compiled_model(**input_dict)

if isinstance(expected_out, paddle.Tensor):
expected_out = [expected_out]
compiled_out = [compiled_out]
if isinstance(expected_out, list) or isinstance(expected_out, tuple):
for a, b in zip(expected_out, compiled_out):
if (a is None and b is not None) or (a is not None and b is None):
raise ValueError("Both expected_out and compiled_out must be not None.")
expected_out = [
regular_item(item) for item in expected_out if np.array(item).size != 0
regular_item(item)
for item in expected_out
if item is not None and np.array(item).size != 0
]
compiled_out = [
regular_item(item) for item in compiled_out if np.array(item).size != 0
regular_item(item)
for item in compiled_out
if item is not None and np.array(item).size != 0
]
else:
raise ValueError("Illegal return value.")
Expand Down
4 changes: 2 additions & 2 deletions graph_net/paddle/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ def main(args):
params.update(inputs)
state_dict = {k: utils.replay_tensor(v) for k, v in params.items()}

y = model(**state_dict)[0]
y = model(**state_dict)

print(np.argmin(y), np.argmax(y))
# print(np.argmin(y), np.argmax(y))
if isinstance(y, paddle.Tensor):
print(y.shape)
elif isinstance(y, list) or isinstance(y, tuple):
Expand Down