MCPcopy Create free account
hub / github.com/KomputeProject/kompute / rebuild

Method rebuild

src/Tensor.cpp:73–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73void
74Tensor::rebuild(void* data,
75 uint32_t elementTotalCount,
76 uint32_t elementMemorySize)
77{
78 KP_LOG_DEBUG("Kompute Tensor rebuilding with size {}", elementTotalCount);
79
80 this->mSize = elementTotalCount;
81 this->mDataTypeMemorySize = elementMemorySize;
82
83 if (this->mPrimaryBuffer || this->mPrimaryMemory) {
84 KP_LOG_DEBUG(
85 "Kompute Tensor destroying existing resources before rebuild");
86 this->destroy();
87 }
88
89 this->allocateMemoryCreateGPUResources();
90
91 if (this->tensorType() != Tensor::TensorTypes::eStorage) {
92 this->mapRawData();
93 memcpy(this->mRawData, data, this->memorySize());
94 }
95}
96
97Tensor::TensorTypes
98Tensor::tensorType()

Callers 2

TensorMethod · 0.95
TESTFunction · 0.45

Calls 5

destroyMethod · 0.95
tensorTypeMethod · 0.95
mapRawDataMethod · 0.95
memorySizeMethod · 0.95

Tested by 1

TESTFunction · 0.36