Skip to content

Commit ee536b6

Browse files
committed
feat(//core/partitioning): Add an ostream implementation for
PartitionInfo Signed-off-by: Naren Dasan <naren@narendasan.com> Signed-off-by: Naren Dasan <narens@nvidia.com>
1 parent 24c3a22 commit ee536b6

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

core/partitioning/BUILD

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ cc_library(
1919
"SegmentedBlock.cpp",
2020
"shape_analysis.cpp",
2121
"partitioning.cpp",
22+
"PartitionInfo.cpp",
2223
],
2324
deps = [
2425
"//core/util:prelude",

core/partitioning/PartitionInfo.cpp

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include <iostream>
2+
#include <sstream>
3+
#include <utility>
4+
5+
#include "core/partitioning/PartitionInfo.h"
6+
7+
namespace trtorch {
8+
namespace core {
9+
namespace partitioning {
10+
// clang-format off
11+
std::ostream& operator<<(std::ostream& os, const PartitionInfo& s) {
12+
os << "Settings requested for Torch Fallback:" \
13+
<< "\n \"enabled\": ";
14+
if (s.enabled) {
15+
os << "True";
16+
os << "\n \"min_block_size\": " << s.min_block_size \
17+
<< "\n \"forced_fallback_operators\": [";
18+
for (auto i : s.forced_fallback_operators) {
19+
os <<"\n " << i << ',';
20+
}
21+
os << "\n ]";
22+
} else {
23+
os << "False";
24+
}
25+
return os;
26+
}
27+
// clang-format on
28+
} // namespace partitioning
29+
} // namespace core
30+
} // namespace trtorch

0 commit comments

Comments
 (0)