Reformatted
This commit is contained in:
parent
c5df89c17b
commit
fdc1d3b91a
23 changed files with 455 additions and 418 deletions
|
|
@ -35,19 +35,18 @@ OpTensorCreate::init()
|
|||
"Kompute OpTensorCreate called with less than 1 tensor");
|
||||
}
|
||||
|
||||
for (std::shared_ptr<Tensor> tensor: this->mTensors) {
|
||||
for (std::shared_ptr<Tensor> tensor : this->mTensors) {
|
||||
if (tensor->isInit()) {
|
||||
throw std::runtime_error("Kompute OpTensorCreate: Tensor has already been initialized");
|
||||
throw std::runtime_error(
|
||||
"Kompute OpTensorCreate: Tensor has already been initialized");
|
||||
}
|
||||
if (tensor->tensorType() == Tensor::TensorTypes::eDevice) {
|
||||
tensor->init(
|
||||
this->mPhysicalDevice, this->mDevice);
|
||||
tensor->init(this->mPhysicalDevice, this->mDevice);
|
||||
|
||||
std::shared_ptr<Tensor> stagingTensor = std::make_shared<Tensor>(
|
||||
tensor->data(), Tensor::TensorTypes::eStaging);
|
||||
|
||||
stagingTensor->init(
|
||||
this->mPhysicalDevice, this->mDevice);
|
||||
stagingTensor->init(this->mPhysicalDevice, this->mDevice);
|
||||
|
||||
stagingTensor->mapDataIntoHostMemory();
|
||||
|
||||
|
|
@ -55,12 +54,11 @@ OpTensorCreate::init()
|
|||
|
||||
} else {
|
||||
|
||||
tensor->init(
|
||||
this->mPhysicalDevice, this->mDevice);
|
||||
tensor->init(this->mPhysicalDevice, this->mDevice);
|
||||
|
||||
tensor->mapDataIntoHostMemory();
|
||||
|
||||
// We push a nullptr when no staging tensor is needed to match
|
||||
// We push a nullptr when no staging tensor is needed to match
|
||||
// index number in array to have one to one mapping with tensors
|
||||
this->mStagingTensors.push_back(nullptr);
|
||||
}
|
||||
|
|
@ -74,8 +72,9 @@ OpTensorCreate::record()
|
|||
|
||||
for (size_t i = 0; i < this->mTensors.size(); i++) {
|
||||
if (this->mTensors[i]->tensorType() == Tensor::TensorTypes::eDevice) {
|
||||
this->mTensors[i]->recordCopyFrom(this->mCommandBuffer, this->mStagingTensors[i], false);
|
||||
}
|
||||
this->mTensors[i]->recordCopyFrom(
|
||||
this->mCommandBuffer, this->mStagingTensors[i], false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue