Reformatted

This commit is contained in:
Alejandro Saucedo 2020-08-20 05:45:54 +01:00
parent 8aa7843f0e
commit 0d18dc50e6
13 changed files with 166 additions and 95 deletions

View file

@ -5,20 +5,22 @@
namespace kp {
OpCreateTensor::OpCreateTensor() {
OpCreateTensor::OpCreateTensor()
{
SPDLOG_DEBUG("Kompute OpCreateTensor constructor base");
}
OpCreateTensor::OpCreateTensor(std::shared_ptr<vk::PhysicalDevice> physicalDevice,
std::shared_ptr<vk::Device> device,
std::shared_ptr<vk::CommandBuffer> commandBuffer)
OpCreateTensor::OpCreateTensor(
std::shared_ptr<vk::PhysicalDevice> physicalDevice,
std::shared_ptr<vk::Device> device,
std::shared_ptr<vk::CommandBuffer> commandBuffer)
: OpBase(physicalDevice, device, commandBuffer)
{
SPDLOG_DEBUG("Kompute OpCreateTensor constructor with params");
}
OpCreateTensor::~OpCreateTensor() {
OpCreateTensor::~OpCreateTensor()
{
SPDLOG_DEBUG("Kompute OpCreateTensor destructor started");
}
@ -28,7 +30,8 @@ OpCreateTensor::init(std::vector<std::shared_ptr<Tensor>> tensors)
SPDLOG_DEBUG("Kompute OpCreateTensor init called");
if (tensors.size() < 1) {
throw std::runtime_error("Kompute OpCreateTensor called with less than 1 tensor");
throw std::runtime_error(
"Kompute OpCreateTensor called with less than 1 tensor");
} else if (tensors.size() > 1) {
spdlog::warn("Kompute OpCreateTensor called with more than 1 tensor");
}
@ -37,15 +40,18 @@ OpCreateTensor::init(std::vector<std::shared_ptr<Tensor>> tensors)
std::vector<uint32_t> data = this->mPrimaryTensor->data();
if (this->mPrimaryTensor->tensorType() == Tensor::TensorTypes::eDevice) {
this->mPrimaryTensor->init(this->mPhysicalDevice, this->mDevice, this->mCommandBuffer);
this->mPrimaryTensor->init(
this->mPhysicalDevice, this->mDevice, this->mCommandBuffer);
this->mStagingTensor = std::make_shared<Tensor>(this->mPrimaryTensor->data(), Tensor::TensorTypes::eStaging);
this->mStagingTensor = std::make_shared<Tensor>(
this->mPrimaryTensor->data(), Tensor::TensorTypes::eStaging);
this->mStagingTensor->init(this->mPhysicalDevice, this->mDevice, this->mCommandBuffer, data);
this->mStagingTensor->init(
this->mPhysicalDevice, this->mDevice, this->mCommandBuffer, data);
}
else {
this->mPrimaryTensor->init(this->mPhysicalDevice, this->mDevice, this->mCommandBuffer, data);
} else {
this->mPrimaryTensor->init(
this->mPhysicalDevice, this->mDevice, this->mCommandBuffer, data);
}
}