mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-16 13:41:30 +08:00
@@ -21,7 +21,7 @@
|
||||
#include "fastdeploy/utils/utils.h"
|
||||
|
||||
namespace fastdeploy {
|
||||
|
||||
namespace function {
|
||||
std::string Str(const std::vector<int64_t>& shape) {
|
||||
std::ostringstream oss;
|
||||
oss << "[ " << shape[0];
|
||||
@@ -121,4 +121,5 @@ void Concat(const std::vector<FDTensor>& x, FDTensor* out, int axis) {
|
||||
*out = std::move(out_temp);
|
||||
}
|
||||
|
||||
} // namespace fastdeploy
|
||||
} // namespace function
|
||||
} // namespace fastdeploy
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include "fastdeploy/core/fd_tensor.h"
|
||||
|
||||
namespace fastdeploy {
|
||||
namespace function {
|
||||
|
||||
/** Excute the concatenate operation for input FDTensor along given axis.
|
||||
@param x The input tensor.
|
||||
@@ -27,4 +28,5 @@ namespace fastdeploy {
|
||||
FASTDEPLOY_DECL void Concat(const std::vector<FDTensor>& x, FDTensor* out,
|
||||
int axis = 0);
|
||||
|
||||
} // namespace function
|
||||
} // namespace fastdeploy
|
||||
|
@@ -15,7 +15,7 @@
|
||||
#include "fastdeploy/function/cuda_cast.h"
|
||||
|
||||
namespace fastdeploy {
|
||||
|
||||
namespace function {
|
||||
template <typename T_IN, typename T_OUT>
|
||||
__global__ void CudaCastKernel(const T_IN* in, T_OUT* out, int edge) {
|
||||
int position = blockDim.x * blockIdx.x + threadIdx.x;
|
||||
@@ -42,4 +42,5 @@ void CudaCast(const FDTensor& in, FDTensor* out, cudaStream_t stream) {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace function
|
||||
} // namespace fastdeploy
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#include "fastdeploy/core/fd_tensor.h"
|
||||
|
||||
namespace fastdeploy {
|
||||
|
||||
namespace function {
|
||||
/** Cast the type of the data in GPU buffer.
|
||||
@param in The input tensor.
|
||||
@param out The output tensor
|
||||
@@ -25,5 +25,5 @@ namespace fastdeploy {
|
||||
*/
|
||||
FASTDEPLOY_DECL void CudaCast(const FDTensor& in, FDTensor* out,
|
||||
cudaStream_t stream);
|
||||
|
||||
} // namespace function
|
||||
} // namespace fastdeploy
|
||||
|
@@ -15,7 +15,7 @@
|
||||
#include "fastdeploy/function/eigen.h"
|
||||
|
||||
namespace fastdeploy {
|
||||
|
||||
namespace function {
|
||||
std::shared_ptr<EigenDeviceWrapper> EigenDeviceWrapper::instance_ = nullptr;
|
||||
|
||||
std::shared_ptr<EigenDeviceWrapper> EigenDeviceWrapper::GetInstance() {
|
||||
@@ -29,4 +29,5 @@ const Eigen::DefaultDevice* EigenDeviceWrapper::GetDevice() const {
|
||||
return &device_;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace fastdeploy
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include "unsupported/Eigen/CXX11/Tensor"
|
||||
|
||||
namespace fastdeploy {
|
||||
namespace function {
|
||||
// EigenDim converts shape into Eigen::DSizes.
|
||||
template <int D>
|
||||
struct EigenDim {
|
||||
@@ -135,4 +136,5 @@ class EigenDeviceWrapper {
|
||||
static std::shared_ptr<EigenDeviceWrapper> instance_;
|
||||
};
|
||||
|
||||
} // namespace function
|
||||
} // namespace fastdeploy
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include "fastdeploy/utils/utils.h"
|
||||
|
||||
namespace fastdeploy {
|
||||
|
||||
namespace function {
|
||||
template <typename T, int Rank>
|
||||
struct PadEigen {
|
||||
using Array = std::array<std::pair<int64_t, int64_t>, Rank>;
|
||||
@@ -123,4 +123,5 @@ void Pad(const FDTensor& x, FDTensor* out, const std::vector<int>& pads, float v
|
||||
|
||||
|
||||
|
||||
} // namespace function
|
||||
} // namespace fastdeploy
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#include "fastdeploy/core/fd_tensor.h"
|
||||
|
||||
namespace fastdeploy {
|
||||
|
||||
namespace function {
|
||||
/** Excute the pad operation for input FDTensor along given dims.
|
||||
@param x The input tensor.
|
||||
@param out The output tensor which stores the result.
|
||||
@@ -27,4 +27,5 @@ namespace fastdeploy {
|
||||
FASTDEPLOY_DECL void Pad(const FDTensor& x, FDTensor* out,
|
||||
const std::vector<int>& pads, float pad_value = 0);
|
||||
|
||||
}
|
||||
} // namespace fastdeploy
|
||||
|
@@ -23,7 +23,7 @@
|
||||
#include "fastdeploy/utils/utils.h"
|
||||
|
||||
namespace fastdeploy {
|
||||
|
||||
namespace function {
|
||||
template <typename T, size_t D, size_t R_D, typename Functor>
|
||||
void ReduceFunctor(const FDTensor& input, FDTensor* output,
|
||||
const std::vector<int64_t>& dims, bool keep_dim) {
|
||||
@@ -402,4 +402,5 @@ void ArgMin(const FDTensor& x, FDTensor* out, int64_t axis,
|
||||
}));
|
||||
}
|
||||
|
||||
} // namespace fastdeploy
|
||||
} // namespace function
|
||||
} // namespace fastdeploy
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#include "fastdeploy/core/fd_tensor.h"
|
||||
|
||||
namespace fastdeploy {
|
||||
|
||||
namespace function {
|
||||
/** Excute the maximum operation for input FDTensor along given dims.
|
||||
@param x The input tensor.
|
||||
@param out The output tensor which stores the result.
|
||||
@@ -123,4 +123,5 @@ FASTDEPLOY_DECL void ArgMin(const FDTensor& x, FDTensor* out, int64_t axis,
|
||||
FDDataType output_dtype = FDDataType::INT64,
|
||||
bool keep_dim = false, bool flatten = false);
|
||||
|
||||
} // namespace function
|
||||
} // namespace fastdeploy
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
#include "fastdeploy/function/eigen.h"
|
||||
namespace fastdeploy {
|
||||
|
||||
namespace function {
|
||||
//////// Max Functor ///////
|
||||
struct MaxFunctor {
|
||||
template <typename X, typename Y, typename Dim>
|
||||
@@ -73,4 +73,5 @@ struct ProdFunctor {
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace function
|
||||
} // namespace fastdeploy
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include "fastdeploy/utils/utils.h"
|
||||
|
||||
namespace fastdeploy {
|
||||
namespace function {
|
||||
template <typename T>
|
||||
struct ValueClip {
|
||||
T operator()(const T& x) const {
|
||||
@@ -124,4 +125,5 @@ void Softmax(const FDTensor& x, FDTensor* out, int axis) {
|
||||
([&] { SoftmaxKernel<data_t>(x, &out_tmp, axis); }));
|
||||
*out = std::move(out_tmp);
|
||||
}
|
||||
} // namespace function
|
||||
} // namespace fastdeploy
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#include "fastdeploy/core/fd_tensor.h"
|
||||
|
||||
namespace fastdeploy {
|
||||
|
||||
namespace function {
|
||||
/** Excute the softmax operation for input FDTensor along given dims.
|
||||
@param x The input tensor.
|
||||
@param out The output tensor which stores the result.
|
||||
@@ -25,4 +25,5 @@ namespace fastdeploy {
|
||||
*/
|
||||
FASTDEPLOY_DECL void Softmax(const FDTensor& x, FDTensor* out, int axis = -1);
|
||||
|
||||
} // namespace function
|
||||
} // namespace fastdeploy
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#include "fastdeploy/utils/utils.h"
|
||||
|
||||
namespace fastdeploy {
|
||||
|
||||
namespace function {
|
||||
template <typename T>
|
||||
struct TransposeNormalKernel {
|
||||
void operator()(const FDTensor& in, FDTensor* out,
|
||||
@@ -121,4 +121,5 @@ void Transpose(const FDTensor& x, FDTensor* out,
|
||||
*out = std::move(out_temp);
|
||||
}
|
||||
|
||||
} // namespace fastdeploy
|
||||
} // namespace function
|
||||
} // namespace fastdeploy
|
||||
|
@@ -17,7 +17,7 @@
|
||||
#include "fastdeploy/core/fd_tensor.h"
|
||||
|
||||
namespace fastdeploy {
|
||||
|
||||
namespace function {
|
||||
/** Excute the transpose operation for input FDTensor along given dims.
|
||||
@param x The input tensor.
|
||||
@param out The output tensor which stores the result.
|
||||
@@ -25,4 +25,5 @@ namespace fastdeploy {
|
||||
*/
|
||||
FASTDEPLOY_DECL void Transpose(const FDTensor& x, FDTensor* out,
|
||||
const std::vector<int64_t>& dims);
|
||||
} // namespace function
|
||||
} // namespace fastdeploy
|
||||
|
Reference in New Issue
Block a user