Skip to content

Commit

Permalink
Allow to print null.
Browse files Browse the repository at this point in the history
This is useful when printing a vector of `Statement*` where some
elements are null. For example,
https://github.com/NVIDIA/Fuser/blob/1aa6ed072d890d75b9f2114a2c00f918d4ab75b4/csrc/ops/composite.cpp#L80-L81.
  • Loading branch information
wujingyue committed Oct 3, 2024
1 parent a8085d2 commit 96ed5e8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion csrc/ir/iostream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,11 @@ void IrTransformPrinter::printTransforms(const TensorView* tv) {
}

std::ostream& operator<<(std::ostream& os, const Statement* stmt) {
return os << stmt->toString();
if (stmt == nullptr) {
return os << "<null>";
} else {
return os << stmt->toString();
}
}

std::ostream& operator<<(std::ostream& os, Fusion* f) {
Expand Down

0 comments on commit 96ed5e8

Please sign in to comment.