Skip to content

Commit

Permalink
feat(//core/partitioning): Add an ostream implementation for
Browse files Browse the repository at this point in the history
PartitionInfo

Signed-off-by: Naren Dasan <naren@narendasan.com>
Signed-off-by: Naren Dasan <narens@nvidia.com>
  • Loading branch information
narendasan committed Apr 7, 2021
1 parent 24c3a22 commit ee536b6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions core/partitioning/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ cc_library(
"SegmentedBlock.cpp",
"shape_analysis.cpp",
"partitioning.cpp",
"PartitionInfo.cpp",
],
deps = [
"//core/util:prelude",
Expand Down
30 changes: 30 additions & 0 deletions core/partitioning/PartitionInfo.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include <iostream>
#include <sstream>
#include <utility>

#include "core/partitioning/PartitionInfo.h"

namespace trtorch {
namespace core {
namespace partitioning {
// clang-format off
std::ostream& operator<<(std::ostream& os, const PartitionInfo& s) {
os << "Settings requested for Torch Fallback:" \
<< "\n \"enabled\": ";
if (s.enabled) {
os << "True";
os << "\n \"min_block_size\": " << s.min_block_size \
<< "\n \"forced_fallback_operators\": [";
for (auto i : s.forced_fallback_operators) {
os <<"\n " << i << ',';
}
os << "\n ]";
} else {
os << "False";
}
return os;
}
// clang-format on
} // namespace partitioning
} // namespace core
} // namespace trtorch

0 comments on commit ee536b6

Please sign in to comment.