Skip to content

Commit

Permalink
refactor: cpu split input execute
Browse files Browse the repository at this point in the history
  • Loading branch information
liang1232018 committed Apr 1, 2024
1 parent c3159da commit 3cc4f66
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/backends/cpu/CPUSplitInput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,14 @@ ErrorCode CPUSplitInput::setUp(vector<shared_ptr<Tensor>> inputs, vector<shared_
}

ErrorCode CPUSplitInput::execute(vector<shared_ptr<Tensor>> inputs, vector<shared_ptr<Tensor>> outputs) {
std::cout << "CPUSplitInput::execute" << std::endl;
std::cout << inputs[0]->dtype() << std::endl;
std::cout << outputs[0]->dtype() << std::endl;
std::cout << outputs[1]->dtype() << std::endl;
std::cout << outputs[2]->dtype() << std::endl;


// copy data from input to output
int offset = 0;
memcpy(outputs[0]->hostPtr<void>(), inputs[0]->hostPtr<void>(), outputs[0]->cntSize());
offset += outputs[0]->cntSize();
memcpy(outputs[1]->hostPtr<void>(), (bool*)inputs[0]->hostPtr<void>() + offset, outputs[1]->cntSize());
memcpy(outputs[1]->hostPtr<void>(), inputs[0]->hostPtr<uint8_t>() + offset, outputs[1]->cntSize());
offset += outputs[1]->cntSize();
memcpy(outputs[2]->hostPtr<void>(), (bool*)inputs[0]->hostPtr<void>() + offset, outputs[2]->cntSize());
memcpy(outputs[2]->hostPtr<void>(), inputs[0]->hostPtr<uint8_t>() + offset, outputs[2]->cntSize());

return Op::execute(inputs, outputs);
}
} // namespace mllm
Expand Down

0 comments on commit 3cc4f66

Please sign in to comment.