标签:std sum auto max code int exp push i++
#include <vector>
#include <cmath> //math.h
std::vector<double> vsoftmax(std::vector<double> &v) {
double sum=0;
for(auto iter:v) {
sum+=exp(iter);
}
std::vector<double> res;
for(int i=0;i<v.size();i++) {
res.push_back(exp(v[i])/sum);
}
return res;
}
标签:std sum auto max code int exp push i++
原文地址:https://www.cnblogs.com/smallredness/p/10749130.html