Commit 3502b44e authored by Po-Yen, Chen's avatar Po-Yen, Chen
Browse files

Use ADL to find stream operator

parent 236bd148
...@@ -24,18 +24,20 @@ std::ostream& operator<<(std::ostream& os, const std::array<T, N>& v) ...@@ -24,18 +24,20 @@ std::ostream& operator<<(std::ostream& os, const std::array<T, N>& v)
return os; return os;
} }
namespace ck {
template <typename... Ts> template <typename... Ts>
std::ostream& operator<<(std::ostream& os, const ck::TensorDescriptor<Ts...>& desc) std::ostream& operator<<(std::ostream& os, const TensorDescriptor<Ts...>& desc)
{ {
constexpr ck::index_t nDim = ck::remove_cvref_t<decltype(desc)>::GetNumOfDimension(); constexpr index_t nDim = remove_cvref_t<decltype(desc)>::GetNumOfDimension();
os << "{"; os << "{";
ck::static_for<0, nDim - 1, 1>{}([&](auto i) { os << desc.GetLength(i) << ", "; }); static_for<0, nDim - 1, 1>{}([&](auto i) { os << desc.GetLength(i) << ", "; });
os << desc.GetLength(ck::Number<nDim - 1>{}); os << desc.GetLength(Number<nDim - 1>{});
os << "}"; os << "}";
return os; return os;
} }
} // namespace ck
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment