From b940fd6a17b32ad87bdafc57adccb4433cf3fb75 Mon Sep 17 00:00:00 2001 From: Anthony Barbier Date: Mon, 4 Jun 2018 14:14:32 +0100 Subject: COMPMID-1181 Added some of the missing type printers Change-Id: Ia5e631aa9252ae65137ba931259ce56be1dca397 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/133968 Tested-by: Jenkins Reviewed-by: Pablo Tello --- utils/TypePrinter.h | 156 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) (limited to 'utils/TypePrinter.h') diff --git a/utils/TypePrinter.h b/utils/TypePrinter.h index 4c697ecca6..7638759b46 100644 --- a/utils/TypePrinter.h +++ b/utils/TypePrinter.h @@ -42,6 +42,25 @@ namespace arm_compute { +/** Formatted output if arg is not null + * + * @param[in] arg Object to print + * + * @return String representing arg. + */ +template +std::string to_string_if_not_null(T *arg) +{ + if(arg == nullptr) + { + return "nullptr"; + } + else + { + return to_string(*arg); + } +} + /** Formatted output of the Dimensions type. * * @param[out] os Output stream. @@ -902,6 +921,143 @@ inline std::string to_string(const Coordinates &coord) return str.str(); } +/** Formatted output of the GEMMReshapeInfo type. + * + * @param[out] os Output stream. + * @param[in] info Type to output. + * + * @return Modified output stream. + */ +inline ::std::ostream &operator<<(::std::ostream &os, const GEMMReshapeInfo &info) +{ + os << "{m=" << info.m() << ","; + os << "n=" << info.n() << ","; + os << "k=" << info.k() << ","; + os << "mult_transpose1xW_width=" << info.mult_transpose1xW_width() << ","; + os << "mult_interleave4x4_height=" << info.mult_interleave4x4_height(); + os << "}"; + + return os; +} + +/** Formatted output of the GEMMInfo type. + * + * @param[out] os Output stream. + * @param[in] info Type to output. + * + * @return Modified output stream. + */ +inline ::std::ostream &operator<<(::std::ostream &os, const GEMMInfo &info) +{ + os << "{is_a_reshaped=" << info.is_a_reshaped() << ","; + os << "is_b_reshaped=" << info.is_b_reshaped() << ","; + os << "reshape_b_only_on_first_run=" << info.reshape_b_only_on_first_run() << ","; + os << "reshape_info=" << info.reshape_info(); + os << "}"; + + return os; +} + +/** Formatted output of the Window::Dimension type. + * + * @param[out] os Output stream. + * @param[in] dim Type to output. + * + * @return Modified output stream. + */ +inline ::std::ostream &operator<<(::std::ostream &os, const Window::Dimension &dim) +{ + os << "{start=" << dim.start() << ", end=" << dim.end() << ", step=" << dim.step() << "}"; + + return os; +} +/** Formatted output of the Window type. + * + * @param[out] os Output stream. + * @param[in] win Type to output. + * + * @return Modified output stream. + */ +inline ::std::ostream &operator<<(::std::ostream &os, const Window &win) +{ + os << "{"; + for(unsigned int i = 0; i < Coordinates::num_max_dimensions; i++) + { + if(i > 0) + { + os << ", "; + } + os << win[i]; + } + os << "}"; + + return os; +} + +/** Formatted output of the WeightsInfo type. + * + * @param[in] info Type to output. + * + * @return Formatted string. + */ +inline std::string to_string(const WeightsInfo &info) +{ + std::stringstream str; + str << info; + return str.str(); +} + +/** Formatted output of the GEMMReshapeInfo type. + * + * @param[in] info Type to output. + * + * @return Formatted string. + */ +inline std::string to_string(const GEMMReshapeInfo &info) +{ + std::stringstream str; + str << info; + return str.str(); +} + +/** Formatted output of the GEMMInfo type. + * + * @param[in] info Type to output. + * + * @return Formatted string. + */ +inline std::string to_string(const GEMMInfo &info) +{ + std::stringstream str; + str << info; + return str.str(); +} + +/** Formatted output of the Window::Dimension type. + * + * @param[in] dim Type to output. + * + * @return Formatted string. + */ +inline std::string to_string(const Window::Dimension &dim) +{ + std::stringstream str; + str << dim; + return str.str(); +} +/** Formatted output of the Window type. + * + * @param[in] win Type to output. + * + * @return Formatted string. + */ +inline std::string to_string(const Window &win) +{ + std::stringstream str; + str << win; + return str.str(); +} + /** Formatted output of the Rectangle type. * * @param[out] os Output stream. -- cgit v1.2.1