| 227 | } |
| 228 | |
| 229 | bool CheckValidOutput(phi::DenseTensor* tensor, size_t batch_size) { |
| 230 | auto& dims = tensor->dims(); |
| 231 | if (dims.size() != 2) return false; |
| 232 | if (!tensor->lod().empty()) { |
| 233 | auto& lod = tensor->lod()[0]; |
| 234 | if (lod.size() != batch_size + 1) { |
| 235 | return false; |
| 236 | } |
| 237 | } else { |
| 238 | if (dims[0] != static_cast<int>(batch_size)) { |
| 239 | return false; |
| 240 | } |
| 241 | } |
| 242 | return true; |
| 243 | } |
| 244 | |
| 245 | void DeviceWorker::DumpParam(const Scope& scope, const int batch_id) { |
| 246 | std::ostringstream os; |