Path: blob/master/modules/dnn/src/vkcom/include/op_softmax.hpp
16344 views
// This file is part of OpenCV project.1// It is subject to the license terms in the LICENSE file found in the top-level directory2// of this distribution and at http://opencv.org/license.html.3//4// Copyright (C) 2018, Intel Corporation, all rights reserved.5// Third party copyrights are property of their respective owners.67#ifndef OPENCV_DNN_VKCOM_OP_SOFTMAX_HPP8#define OPENCV_DNN_VKCOM_OP_SOFTMAX_HPP910#include "vkcom.hpp"11#include "op_base.hpp"1213namespace cv { namespace dnn { namespace vkcom {1415#ifdef HAVE_VULKAN1617struct SoftmaxShaderConfig18{19int local_size_x;20int local_size_y;21int local_size_z;22int block_height;23int block_width;24int block_depth;25};2627class OpSoftmax: public OpBase28{29public:30OpSoftmax(const int axis, const bool log_softmax = false);31~OpSoftmax();32void reshapeOutTensor(Tensor& in, Tensor& out);33bool forward(Tensor& in, Tensor& out);34virtual bool forward(std::vector<Tensor>& ins,35std::vector<Tensor>& blobs,36std::vector<Tensor>& outs) CV_OVERRIDE;37private:38bool init(const int axis, const bool log_softmax);39bool computeGroupCount();4041int axis_;42int channels_;43int channel_size_;44int outer_size_;45bool log_softmax_;46SoftmaxShaderConfig config_;47Tensor* max_tensor_;48Tensor* sum_tensor_;49};5051#endif // HAVE_VULKAN5253}}} // namespace cv::dnn::vkcom5455#endif // OPENCV_DNN_VKCOM_OP_SOFTMAX_HPP565758