| 113 | } |
| 114 | } |
| 115 | std::string PrintDenseTensorIntType(phi::DenseTensor* tensor, |
| 116 | int64_t start, |
| 117 | int64_t end, |
| 118 | char separator = ',', |
| 119 | bool need_leading_separator = true) { |
| 120 | auto count = tensor->numel(); |
| 121 | if (start < 0 || end > count) { |
| 122 | VLOG(3) << "access violation"; |
| 123 | return "access violation"; |
| 124 | } |
| 125 | if (start >= end) return ""; |
| 126 | std::ostringstream os; |
| 127 | if (!need_leading_separator) { |
| 128 | os << static_cast<uint64_t>(tensor->data<int64_t>()[start]); |
| 129 | start++; |
| 130 | } |
| 131 | for (int64_t i = start; i < end; i++) { |
| 132 | // os << ":" << static_cast<uint64_t>(tensor->data<int64_t>()[i]); |
| 133 | os << separator << static_cast<uint64_t>(tensor->data<int64_t>()[i]); |
| 134 | } |
| 135 | return os.str(); |
| 136 | } |
| 137 | |
| 138 | void PrintDenseTensorIntType(phi::DenseTensor* tensor, |
| 139 | int64_t start, |
no test coverage detected