message: [BatchResource] Reserve vector lengths before pushing tensors.
  This avoids taking the slow path when the vector is resized, and avoids calls to the Tensor move constructor and destructor.
  Also fix lint warnings in batch_kernels.cc.
diff: @@ -30,6 +30,7 @@ limitations under the License.
  #include "tensorflow/core/platform/context.h"
  #include "tensorflow/core/platform/errors.h"
  #include "tensorflow/core/platform/macros.h"
  +#include "tensorflow/core/util/ptr_util.h"
  namespace tensorflow {
  @@ -44,7 +45,7 @@ typedef Eigen::SyclDevice SYCLDevice;
  // op's output at position 'output_index', using 'context' for the allocation to
  // ensure proper device placement.
  template <typename T>
  -Status Concat(OpKernelContext* context, const gtl::ArraySlice<Tensor>& inputs,
  +Status Concat(OpKernelContext* context, const gtl::ArraySlice<Tensor> inputs,
  Tensor* output) {
  const int input_dims = inputs[0].dims();
  const TensorShape& input_shape = inputs[0].shape();
  @@ -106,7 +107,7 @@ Status Concat(OpKernelContext* context, const gtl::ArraySlice<Tensor>& inputs,
  // applicable special case and wrote to the outputs. Otherwise acts as a no-op.
  template <typename T>
  Status SplitEasyCases(OpKernelContext* context, const Tensor& input,
  - const gtl::ArraySlice<int64>& sizes,
  + const gtl::ArraySlice<int64> sizes,
  std::vector<Tensor>* outputs, bool* done) {
  *done = false;
  @@ -143,7 +144,7 @@ Status SplitEasyCases(OpKernelContext* context, const Tensor& input,
  // Handles the general case, on CPU.
  template <typename T>
  Status SplitCPU(OpKernelContext* context, const Tensor& input,
  - const gtl::ArraySlice<int64>& sizes,
  + const gtl::ArraySlice<int64> sizes,
  std::vector<Tensor>* outputs) {
  int64 suffix_dim_size = 1;
  for (int i = 1; i < input.shape().dims(); ++i) {
  @@ -192,8 +193,7 @@ Status SplitGPU(OpKernelContext* context, const Tensor& input,
  // The outer function that dispatches to the various Split*() functions above.
  template <typename T>
  Status Split(OpKernelContext* context, const Tensor& input,
  - const gtl::ArraySlice<int64>& sizes,
  - std::vector<Tensor>* outputs) {
  + const gtl::ArraySlice<int64> sizes, std::vector<Tensor>* outputs) {
  bool easy_cases_done;
  TF_RETURN_IF_ERROR(
  SplitEasyCases<T>(context, input, sizes, outputs, &easy_cases_done));
  @@ -245,13 +245,13 @@ class BatchResource : public ResourceBase {
  Status RegisterInput(int64 guid, OpKernelContext* context,
  const string& batcher_queue_name,
  AsyncOpKernel::DoneCallback done_callback) {
  - std::unique_ptr<BatchTask> batch_components(new BatchTask);
  + auto batch_components = MakeUnique<BatchTask>();
  batch_components->guid = guid;
  batch_components->propagated_context = Context(ContextKind::kThread);
  OpInputList tensors;
  TF_RETURN_IF_ERROR(context->input_list("in_tensors", &tensors));
  - for (int i = 0; i < tensors.size(); ++i) {
  - const Tensor& tensor = tensors[i];
  + batch_components->inputs.reserve(tensors.size());
  + for (const Tensor& tensor : tensors) {
  if (tensor.shape().dims() == 0) {
  return errors::InvalidArgument(
  "Batching input tensors must have at least one dimension");
  @@ -268,6 +268,7 @@ class BatchResource : public ResourceBase {
  const auto captured_status =
  context->input_list("captured_tensors", &captured_tensors);
  if (captured_status.ok()) {
  + batch_components->captured_inputs.reserve(captured_tensors.size());
  for (const Tensor& captured_tensor : captured_tensors) {
  batch_components->captured_inputs.push_back(captured_tensor);
  }
  