mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 09:07:10 +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:
@@ -163,5 +163,20 @@ void Slice(const FDTensor& x, const std::vector<int64_t>& axes,
|
||||
}));
|
||||
}
|
||||
|
||||
void Slice(const FDTensor& x, const std::vector<int64_t>& axes,
|
||||
const std::vector<int64_t>& index, FDTensor* out) {
|
||||
std::vector<int64_t> ends = index;
|
||||
for (int i = 0; i < ends.size(); ++i) {
|
||||
ends[i] += 1;
|
||||
}
|
||||
Slice(x, axes, index, ends, out);
|
||||
for (int i = 0; i < axes.size(); ++i) {
|
||||
if (out->Shape().size() <= 1) {
|
||||
break;
|
||||
}
|
||||
out->Squeeze(axes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace function
|
||||
} // namespace fastdeploy
|
||||
|
Reference in New Issue
Block a user