|
|
|
@ -103,7 +103,7 @@ template <typename T>
|
|
|
|
|
void PrintScalarToString(const char *str_data_ptr, const string &tensor_type, std::ostringstream *const buf) {
|
|
|
|
|
MS_EXCEPTION_IF_NULL(str_data_ptr);
|
|
|
|
|
MS_EXCEPTION_IF_NULL(buf);
|
|
|
|
|
*buf << "Tensor(shape=[1], dtype=" << GetParseType(tensor_type) << ", value=";
|
|
|
|
|
*buf << "Tensor(shape=[], dtype=" << GetParseType(tensor_type) << ", value=";
|
|
|
|
|
const T *data_ptr = reinterpret_cast<const T *>(str_data_ptr);
|
|
|
|
|
if constexpr (std::is_same<T, int8_t>::value || std::is_same<T, uint8_t>::value) {
|
|
|
|
|
const int int_data = static_cast<int>(*data_ptr);
|
|
|
|
@ -117,7 +117,7 @@ void PrintScalarToBoolString(const char *str_data_ptr, const string &tensor_type
|
|
|
|
|
MS_EXCEPTION_IF_NULL(str_data_ptr);
|
|
|
|
|
MS_EXCEPTION_IF_NULL(buf);
|
|
|
|
|
const bool *data_ptr = reinterpret_cast<const bool *>(str_data_ptr);
|
|
|
|
|
*buf << "Tensor(shape=[1], dtype=" << GetParseType(tensor_type) << ", value=";
|
|
|
|
|
*buf << "Tensor(shape=[], dtype=" << GetParseType(tensor_type) << ", value=";
|
|
|
|
|
if (*data_ptr) {
|
|
|
|
|
*buf << "True)\n";
|
|
|
|
|
} else {
|
|
|
|
|