diff options
author | Anthony Barbier <anthony.barbier@arm.com> | 2018-06-04 14:14:32 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:52:54 +0000 |
commit | b940fd6a17b32ad87bdafc57adccb4433cf3fb75 (patch) | |
tree | 8a984db60b980d8714b5f7568590b52a591ae724 | |
parent | 52ecb06b5627902a2f4514fba977e98454af4872 (diff) | |
download | ComputeLibrary-b940fd6a17b32ad87bdafc57adccb4433cf3fb75.tar.gz |
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 <bsgcomp@arm.com>
Reviewed-by: Pablo Tello <pablo.tello@arm.com>
-rw-r--r-- | utils/TypePrinter.h | 156 |
1 files changed, 156 insertions, 0 deletions
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 <typename T> +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. |