Optimize ExecutionFrame to avoid mem re-allocation. (#1085)

This commit is contained in:
ybrnathan 2019-05-23 10:59:36 -07:00 committed by GitHub
parent 055f5af78d
commit 7421755198
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -190,6 +190,8 @@ ExecutionFrame::ExecutionFrame(const std::vector<int>& feed_mlvalue_idxs, const
if (session_state.GetEnableMemoryPattern() && session_state.GetExecutionPlan()) {
std::vector<TensorShape> input_shapes;
bool all_tensors = true;
// Reserve mem to avoid re-allocation.
input_shapes.reserve(feeds.size());
for (const auto& feed : feeds) {
if (!(feed.IsTensor())) {
all_tensors = false;