!9951 Print the row_id for map when error happens

From: @alexyuyue
Reviewed-by: 
Signed-off-by:
This commit is contained in:
mindspore-ci-bot 2021-01-15 06:03:41 +08:00 committed by Gitee
commit a575af7198
4 changed files with 11 additions and 4 deletions

View File

@ -39,7 +39,14 @@ Status CpuMapJob::Run(std::vector<TensorRow> in, std::vector<TensorRow> *out) {
TensorRow result_row;
for (size_t i = 0; i < ops_.size(); i++) {
// Call compute function for cpu
RETURN_IF_NOT_OK(ops_[i]->Compute(input_row, &result_row));
Status rc = ops_[i]->Compute(input_row, &result_row);
if (rc.IsError()) {
if (input_row.getId() >= 0) {
MS_LOG(ERROR) << "The TensorRow with id=" + std::to_string(input_row.getId()) + " failed on " +
std::to_string(i) + " TensorOp in Map: " + ops_[i]->Name();
}
return rc;
}
// Assign result_row to to_process for the next TensorOp processing, except for the last TensorOp in the list.
if (i + 1 < ops_.size()) {
@ -48,7 +55,6 @@ Status CpuMapJob::Run(std::vector<TensorRow> in, std::vector<TensorRow> *out) {
}
out->push_back(std::move(result_row));
}
return Status::OK();
}

View File

@ -27,7 +27,7 @@ GpuMapJob::GpuMapJob(std::vector<std::shared_ptr<TensorOp>> operations) : MapJob
// Destructor
GpuMapJob::~GpuMapJob() = default;
// A function to execute a cpu map job
// A function to execute a gpu map job
Status GpuMapJob::Run(std::vector<TensorRow> in, std::vector<TensorRow> *out) {
// Do nothing for now
return Status::OK();

View File

@ -287,6 +287,7 @@ Status MapOp::WorkerCompute(DataBuffer *in_buffer, TensorQTable *new_tensor_tabl
// From the current row, select the Tensor that need to be passed to TensorOp
(void)std::transform(to_process_indices_.begin(), to_process_indices_.end(), std::back_inserter(to_process),
[&cur_row](const auto &it) { return std::move(cur_row[it]); });
to_process.setId(cur_row.getId());
job_input_table.push_back(std::move(to_process));
original_table.push_back(std::move(cur_row));
}

View File

@ -135,7 +135,7 @@ constexpr char kCFuncOp[] = "CFuncOp";
constexpr char kPyFuncOp[] = "PyFuncOp";
constexpr char kNoOp[] = "NoOp";
// A class that does a computation on a Tensor
// A class that does a computation on a Tensor
class TensorOp {
public:
TensorOp() = default;