diff --git a/source/backend/vulkan/image/execution/VulkanSoftmax.cpp b/source/backend/vulkan/image/execution/VulkanSoftmax.cpp index 7c19595fd..d86750a66 100644 --- a/source/backend/vulkan/image/execution/VulkanSoftmax.cpp +++ b/source/backend/vulkan/image/execution/VulkanSoftmax.cpp @@ -13,14 +13,14 @@ namespace MNN { struct SoftmaxConstBuffer { - uint N; - uint H; - uint W; - uint C4; - uint CLeft; + uint32_t N; + uint32_t H; + uint32_t W; + uint32_t C4; + uint32_t CLeft; }; -VulkanSoftmax::VulkanSoftmax(const Op* op, Backend* bn, const uint axisIndex) : VulkanBasicExecution(bn) { +VulkanSoftmax::VulkanSoftmax(const Op* op, Backend* bn, const uint32_t axisIndex) : VulkanBasicExecution(bn) { mAxisIndex = axisIndex; auto vkBn = (VulkanBackend*)backend(); std::string shaderName = "glsl_softmaxImage_"; @@ -55,7 +55,7 @@ ErrorCode VulkanSoftmax::onEncode(const std::vector& inputs, const std: auto input = inputs[0]; auto output = outputs[0]; auto inputShapeNHWC = VulkanTensor::tensorShapeFormat(input); - std::vector cpuSoftmaxConstBuffer = {(uint)inputShapeNHWC[0], (uint)inputShapeNHWC[1], (uint)inputShapeNHWC[2], (uint)UP_DIV(inputShapeNHWC[3], 4), (uint)ROUND_UP(inputShapeNHWC[3], 4) - inputShapeNHWC[3]}; + std::vector cpuSoftmaxConstBuffer = {(uint32_t)inputShapeNHWC[0], (uint32_t)inputShapeNHWC[1], (uint32_t)inputShapeNHWC[2], (uint32_t)UP_DIV(inputShapeNHWC[3], 4), (uint32_t)ROUND_UP(inputShapeNHWC[3], 4) - inputShapeNHWC[3]}; { auto softmaxConst = reinterpret_cast(mSoftmaxConstBuffer->map()); @@ -69,8 +69,8 @@ ErrorCode VulkanSoftmax::onEncode(const std::vector& inputs, const std: } // N * H * W * C4 - uint numTotal = cpuSoftmaxConstBuffer[0] * cpuSoftmaxConstBuffer[1] * cpuSoftmaxConstBuffer[2] * cpuSoftmaxConstBuffer[3]; - uint numY = numTotal / cpuSoftmaxConstBuffer[mAxisIndex]; + uint32_t numTotal = cpuSoftmaxConstBuffer[0] * cpuSoftmaxConstBuffer[1] * cpuSoftmaxConstBuffer[2] * cpuSoftmaxConstBuffer[3]; + uint32_t numY = numTotal / cpuSoftmaxConstBuffer[mAxisIndex]; auto vkOutput = (VulkanTensor*)output->deviceId(); auto vkInput = (VulkanTensor*)input->deviceId(); @@ -98,7 +98,7 @@ class VulkanSoftmaxCreator : public VulkanBackend::Creator { Backend* backend) const override { auto input = inputs[0]; - uint dimension = input->dimensions(); + uint32_t dimension = input->dimensions(); if (dimension > 4) { return nullptr; } @@ -109,7 +109,7 @@ class VulkanSoftmaxCreator : public VulkanBackend::Creator { if (axis < 0) { axis = input->dimensions() + axis; } - std::vector axisMap; + std::vector axisMap; if (dimension == 4) { if (format == MNN_DATA_FORMAT_NCHW) { @@ -130,7 +130,7 @@ class VulkanSoftmaxCreator : public VulkanBackend::Creator { } else { return nullptr; } - uint axisIndex = axisMap[axis]; + uint32_t axisIndex = axisMap[axis]; return new VulkanSoftmax(op, backend, axisIndex); } diff --git a/source/backend/vulkan/image/execution/VulkanSoftmax.hpp b/source/backend/vulkan/image/execution/VulkanSoftmax.hpp index fafd1b34a..38dd3179b 100644 --- a/source/backend/vulkan/image/execution/VulkanSoftmax.hpp +++ b/source/backend/vulkan/image/execution/VulkanSoftmax.hpp @@ -16,7 +16,7 @@ namespace MNN { class VulkanSoftmax : public VulkanBasicExecution { public: - VulkanSoftmax(const Op* op, Backend* bn, const uint axisIndex); + VulkanSoftmax(const Op* op, Backend* bn, const uint32_t axisIndex); virtual ~VulkanSoftmax(); ErrorCode onEncode(const std::vector& inputs, const std::vector& outputs, const VulkanCommandPool::Buffer* cmdBuffer) override; @@ -25,7 +25,7 @@ class VulkanSoftmax : public VulkanBasicExecution { std::shared_ptr mSoftmaxConstBuffer; const VulkanPipeline* mSoftmaxPipeline; std::shared_ptr mDescriptorSet; - uint mAxisIndex; + uint32_t mAxisIndex; }; } // namespace MNN