mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/32728 It doesn't have much to do with tensors anymore. Signed-off-by: Edward Z. Yang <ezyang@fb.com> Test Plan: Imported from OSS Differential Revision: D19628093 Pulled By: ezyang fbshipit-source-id: 4d57111cdf44ba347bec8a32bb5b4b47a83c1eaf
32 lines
564 B
C++
32 lines
564 B
C++
#include <c10/core/DispatchKeySet.h>
|
|
|
|
namespace c10 {
|
|
|
|
std::string toString(DispatchKeySet ts) {
|
|
std::stringstream ss;
|
|
ss << ts;
|
|
return ss.str();
|
|
}
|
|
|
|
std::ostream& operator<<(std::ostream& os, DispatchKeySet ts) {
|
|
if (ts.empty()) {
|
|
os << "DispatchKeySet()";
|
|
return os;
|
|
}
|
|
os << "DispatchKeySet(";
|
|
DispatchKey tid;
|
|
bool first = true;
|
|
while ((tid = ts.highestPriorityTypeId()) != DispatchKey::Undefined) {
|
|
if (!first) {
|
|
os << ", ";
|
|
}
|
|
os << tid;
|
|
ts = ts.remove(tid);
|
|
first = false;
|
|
}
|
|
os << ")";
|
|
return os;
|
|
}
|
|
|
|
}
|