message: Optimize constant proto creation.
diff: @@ -977,8 +977,8 @@ Status ConstantFolding::CreateNodeDef(const string& name,
  if (tensor->NumElements() > 4) {
  #define POPULATE_TENSOR_PROTO(tensor, t, TYPE, NAME) \
  { \
  - const TYPE* val_ptr = tensor->flat<TYPE>().data(); \
  - TYPE last = *val_ptr; \
  + const auto* val_ptr = tensor->flat<TYPE>().data(); \
  + auto last = *val_ptr; \
  int64 last_index = 0; \
  for (int64 i = 0; i < tensor->NumElements(); ++i) { \
  TYPE cur = *val_ptr++; \
  @@ -991,11 +991,10 @@ Status ConstantFolding::CreateNodeDef(const string& name,
  optimized = true; \
  encoded_size = (last_index + 1) * sizeof(NAME); \
  t->mutable_##NAME##_val()->Reserve(last_index + 1); \
  + const auto* src_ptr = tensor->flat<TYPE>().data(); \
  + auto* dst_ptr = \
  t->mutable_##NAME##_val()->AddNAlreadyReserved(last_index + 1); \
  - val_ptr = tensor->flat<TYPE>().data(); \
  - for (int64 i = 0; i <= last_index; ++i) { \
  - t->set_##NAME##_val(i, *val_ptr++); \
  - } \
  + std::copy(src_ptr, src_ptr + last_index + 1, dst_ptr); \
  } \
  } \
  break
  