diff --git a/mindspore/core/ir/tensor.cc b/mindspore/core/ir/tensor.cc index 2fc75b6755377c2506d427812d17331c765de703..c7f3b8fce866653ff4d826d8e82588d079908727 100644 --- a/mindspore/core/ir/tensor.cc +++ b/mindspore/core/ir/tensor.cc @@ -224,10 +224,21 @@ class TensorDataImpl : public TensorData { ss << ' '; } } + + // Set width and indent for different int type. + // + // int8/uint8 width: 3 + // int16/uint16 width: 5 + // int32/uint32 width: 10 + // int64/uint64 width: NOT SET if constexpr (std::is_same::value) { - ss << static_cast(value); + ss << std::setw(3) << std::setiosflags(std::ios::right) << static_cast(value); } else if constexpr (std::is_same::value) { - ss << static_cast(value); + ss << std::setw(3) << std::setiosflags(std::ios::right) << static_cast(value); + } else if constexpr (std::is_same::value || std::is_same::value) { + ss << std::setw(5) << std::setiosflags(std::ios::right) << value; + } else if constexpr (std::is_same::value || std::is_same::value) { + ss << std::setw(10) << std::setiosflags(std::ios::right) << value; } else { ss << value; }