MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / Reserve

Method Reserve

oneflow/core/common/tensor_buffer.cpp:93–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93void TensorBufferImpl::Reserve(size_t new_size) {
94 if (new_size > buffer_size_) {
95 size_t growth_size = std::max(new_size, GetTensorBufferGrowthSize(new_size));
96 DeallocateBuffer();
97 AllocateBuffer(growth_size);
98 } else {
99 size_t shrink_size = GetTensorBufferShrinkSize(buffer_size_);
100 if (new_size <= shrink_size) {
101 DeallocateBuffer();
102 AllocateBuffer(shrink_size);
103 }
104 }
105}
106
107void TensorBufferImpl::CopyFrom(const TensorBufferImpl* src) {
108 if (src == this) { return; }

Callers 4

PushPlanFunction · 0.45
MergePlanFunction · 0.45
InitMethod · 0.45
ConstructPbRpfFunction · 0.45

Calls 2

Tested by

no test coverage detected