| 165 | } |
| 166 | |
| 167 | std::string PrintDenseTensor(phi::DenseTensor* tensor, |
| 168 | int64_t start, |
| 169 | int64_t end, |
| 170 | char separator, |
| 171 | bool need_leading_separator) { |
| 172 | std::string out_val; |
| 173 | if (framework::TransToProtoVarType(tensor->dtype()) == proto::VarType::FP32) { |
| 174 | out_val = PrintDenseTensorType<float>( |
| 175 | tensor, start, end, separator, need_leading_separator); |
| 176 | } else if (framework::TransToProtoVarType(tensor->dtype()) == |
| 177 | proto::VarType::INT64) { |
| 178 | out_val = PrintDenseTensorIntType( |
| 179 | tensor, start, end, separator, need_leading_separator); |
| 180 | } else if (framework::TransToProtoVarType(tensor->dtype()) == |
| 181 | proto::VarType::FP64) { |
| 182 | out_val = PrintDenseTensorType<double>( |
| 183 | tensor, start, end, separator, need_leading_separator); |
| 184 | } else { |
| 185 | out_val = "unsupported type"; |
| 186 | } |
| 187 | return out_val; |
| 188 | } |
| 189 | |
| 190 | void PrintDenseTensor(phi::DenseTensor* tensor, |
| 191 | int64_t start, |