tensorflow/core/common_runtime/base_collective_executor.cc
// Takes ownership of output and prepares to properly alias its chunks.
// Ownership is taken because the shape may temporarily change.
Takes ownership of output and prepares to properly alias its chunks.
Ownership is taken because the shape may temporarily change.
Takes ownership of output and prepares to properly alias its chunks . Ownership is taken because the shape may temporarily change .
CollectiveAdapterImpl(Tensor* output, int64_t num_chunks,
                        Allocator* allocator, bool align_chunks)
      : output_(std::move(*output)),
        dt_(output_.dtype()),
        old_shape_(output_.shape()),
        num_chunks_(num_chunks),
        allocator_(allocator),
        total_elts_(output_.NumElements()),
        chunk_elts_(align_chunks
                        ? AlignedChunkElts(sizeof(T), total_elts_, num_chunks_)
                        : total_elts_ / num_chunks_),
        data_start_(reinterpret_cast<T*>(DMAHelper::base(&output_))),
        data_end_(data_start_ + total_elts_) {
    if (!align_chunks) {
      DCHECK_EQ(total_elts_, num_chunks_ * chunk_elts_);
    }
    DCHECK_GT(chunk_elts_, 0);
    Flatten();
  }
CollectiveAdapterImpl ( Tensor * output , int64_t num_chunks , Allocator * allocator , bool align_chunks ) : output_ ( std :: move ( * output ) ) , dt_ ( output_ . dtype ( ) ) , old_shape_ ( output_ . shape ( ) ) , num_chunks_ ( num_chunks ) , allocator_ ( allocator ) , total_elts_ ( output_ . NumElements ( ) ) , chunk_elts_ ( align_chunks ? AlignedChunkElts ( sizeof ( T ) , total_elts_ , num_chunks_ ) : total_elts_ / num_chunks_ ) , data_start_ ( reinterpret_cast < T * > ( DMAHelper :: base ( & output_ ) ) ) , data_end_ ( data_start_ + total_elts_ ) { if ( ! align_chunks ) { DCHECK_EQ ( total_elts_ , num_chunks_ * chunk_elts_ ) ; } DCHECK_GT ( chunk_elts_ , 0 ) ; Flatten ( ) ; }
Takes ownership of output and prepares to properly alias its chunks.
Takes ownership of output and prepares to properly alias its chunks .