Skip to content

Commit 84a294a

Browse files
larryliu0820facebook-github-bot
authored andcommitted
Allow us to print output metadata for the case where output is not tensor
Summary: As titled. Reviewed By: telgamal-1 Differential Revision: D75694961
1 parent 851f5fc commit 84a294a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

extension/pybindings/pybindings.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,13 @@ struct PyMethodMeta final {
578578
}
579579
py::list output_meta_strs;
580580
for (size_t i = 0; i < meta_.num_outputs(); ++i) {
581-
output_meta_strs.append(py::str(output_tensor_meta(i)->repr()));
581+
auto output_tag_res = meta_.output_tag(i);
582+
THROW_INDEX_IF_ERROR(output_tag_res.error(), "Cannot get Tag for output at %zu", i);
583+
if (output_tag_res.get() == Tag::Tensor) {
584+
output_meta_strs.append(py::str(output_tensor_meta(i)->repr()));
585+
} else {
586+
output_meta_strs.append(py::str(runtime::tag_to_string(output_tag_res.get())));
587+
}
582588
}
583589
// Add quotes to be more similar to Python's repr for strings.
584590
py::str format =

0 commit comments

Comments
 (0)