@@ -788,10 +788,8 @@ std::shared_ptr<ProcessGroup::Task> ProcessGroupNCCL::Send_Partial(
788788  phi::DenseTensor flatten_tensor;
789789  flatten_tensor.ShareDataWith (tensors).Resize ({tensors.numel ()});
790790
791-   phi::DenseTensor shared_input = flatten_tensor.Slice (offset, offset + length);
792- 
793-   std::vector<phi::DenseTensor> shared_tensors;
794-   shared_tensors.push_back (shared_input);
791+   std::vector<phi::DenseTensor> shared_tensors{
792+       flatten_tensor.Slice (offset, offset + length)};
795793
796794  auto  task = PointToPoint (
797795      shared_tensors,
@@ -822,10 +820,8 @@ std::shared_ptr<ProcessGroup::Task> ProcessGroupNCCL::Send_Partial(
822820  phi::DenseTensor flatten_tensor;
823821  flatten_tensor.ShareDataWith (tensors).Resize ({tensors.numel ()});
824822
825-   phi::DenseTensor shared_input = flatten_tensor.Slice (offset, offset + length);
826- 
827-   std::vector<phi::DenseTensor> shared_tensors;
828-   shared_tensors.push_back (shared_input);
823+   std::vector<phi::DenseTensor> shared_tensors{
824+       flatten_tensor.Slice (offset, offset + length)};
829825
830826  auto  task = PointToPoint (
831827      shared_tensors,
@@ -854,10 +850,9 @@ std::shared_ptr<ProcessGroup::Task> ProcessGroupNCCL::Recv_Partial(
854850
855851  phi::DenseTensor flatten_tensor;
856852  flatten_tensor.ShareDataWith (tensors).Resize ({tensors.numel ()});
857-   phi::DenseTensor shared_input = flatten_tensor.Slice (offset, offset + length);
858853
859-   std::vector<phi::DenseTensor> shared_tensors; 
860-   shared_tensors. push_back (shared_input) ;
854+   std::vector<phi::DenseTensor> shared_tensors{ 
855+       flatten_tensor. Slice (offset, offset + length)} ;
861856
862857  auto  task = PointToPoint (
863858      shared_tensors,
@@ -887,10 +882,9 @@ std::shared_ptr<ProcessGroup::Task> ProcessGroupNCCL::Recv_Partial(
887882    bool  use_calc_stream) {
888883  phi::DenseTensor flatten_tensor;
889884  flatten_tensor.ShareDataWith (tensors).Resize ({tensors.numel ()});
890-   phi::DenseTensor shared_input = flatten_tensor.Slice (offset, offset + length);
891885
892-   std::vector<phi::DenseTensor> shared_tensors; 
893-   shared_tensors. push_back (shared_input) ;
886+   std::vector<phi::DenseTensor> shared_tensors{ 
887+       flatten_tensor. Slice (offset, offset + length)} ;
894888
895889  auto  task = PointToPoint (
896890      shared_tensors,
0 commit comments