mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-12-24 13:28:13 +08:00
[Diffusion] Add C++ dpm solver (#714)
* Add BetaForAlphaBar, ConvertModelOutput, SetTimesteps, and constructor for DPMSolverMultistepScheduler * tmp * Add DPMSolverFirstOrderUpdate * Add ScaleModelInput * Add MultiStepDPMSolverSecondOrderUpdate * add MultiStepDPMSolverThirdOrderUpdate * Add Step * Add FASTDEPLOY_DECL * Add AddNoise * Fix operator * update * Fix DPMSolverMultistepScheduler * Upgrade Slice * Fix DPMSolverFirstOrderUpdate * remove FASTDEPLOY_DECL * Add config for dpm solver
This commit is contained in:
@@ -14,9 +14,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "fastdeploy/core/fd_scalar.h"
|
||||
#include "fastdeploy/core/fd_tensor.h"
|
||||
|
||||
namespace fastdeploy {
|
||||
|
||||
namespace function {
|
||||
|
||||
/** Excute the add operation for input FDTensors. *out = x + y.
|
||||
@@ -62,10 +64,42 @@ FASTDEPLOY_DECL void Maximum(const FDTensor& x, const FDTensor& y,
|
||||
|
||||
FASTDEPLOY_DECL FDTensor operator+(const FDTensor& x, const FDTensor& y);
|
||||
|
||||
template <typename T> FDTensor operator+(const FDTensor& x, T y) {
|
||||
return x + FDTensor(Scalar(y));
|
||||
}
|
||||
|
||||
template <typename T> FDTensor operator+(T x, const FDTensor& y) {
|
||||
return FDTensor(Scalar(x)) + y;
|
||||
}
|
||||
|
||||
FASTDEPLOY_DECL FDTensor operator-(const FDTensor& x, const FDTensor& y);
|
||||
|
||||
template <typename T> FDTensor operator-(const FDTensor& x, T y) {
|
||||
return x - FDTensor(Scalar(y));
|
||||
}
|
||||
|
||||
template <typename T> FDTensor operator-(T x, const FDTensor& y) {
|
||||
return FDTensor(Scalar(x)) - y;
|
||||
}
|
||||
|
||||
FASTDEPLOY_DECL FDTensor operator*(const FDTensor& x, const FDTensor& y);
|
||||
|
||||
template <typename T> FDTensor operator*(const FDTensor& x, T y) {
|
||||
return x * FDTensor(Scalar(y));
|
||||
}
|
||||
|
||||
template <typename T> FDTensor operator*(T x, const FDTensor& y) {
|
||||
return FDTensor(Scalar(x)) * y;
|
||||
}
|
||||
|
||||
FASTDEPLOY_DECL FDTensor operator/(const FDTensor& x, const FDTensor& y);
|
||||
|
||||
template <typename T> FDTensor operator/(const FDTensor& x, T y) {
|
||||
return x / FDTensor(Scalar(y));
|
||||
}
|
||||
|
||||
template <typename T> FDTensor operator/(T x, const FDTensor& y) {
|
||||
return FDTensor(Scalar(x)) / y;
|
||||
}
|
||||
|
||||
} // namespace fastdeploy
|
||||
|
||||
Reference in New Issue
Block a user