相关文章推荐
想表白的面包
·
js模拟键盘按下ctrl+v健_百度知道
·
2 年前
·
有腹肌的黄花菜
·
python--sys.stdout重定向_ ...
·
2 年前
·
Code
›
softmax function in c++ - 东宫得臣
博客园
softmax
https://www.cnblogs.com/donggongdechen/p/11049648.html
火星上的羽毛球
2 年前
template
void
softmax(
const
typename::std::vector<T> &v, typename::std::vector<T> &
s){
double
sum=
0.0
; transform(v.begin(), v.end(), s.begin(), myfunction); sum
=
accumulate(s.begin(), s.end(), sum);
for
(size_t i=
0
; i<s.size(); ++
i) s.at(i)
/=
sum;
int
main() {
double
a[]={
1.0
,
3.0
,
2.0
}; std::vector
<
double
> v_a(a, a+
sizeof
a/
sizeof
a[
0
]), v_b(v_a); std::vector
<
double
>::const_iterator it=
v_a.begin();
for
(; it!=v_a.end(); ++
it) { std::cout
<<*it<<
"
"
; std::cout
<<
std::endl; softmax(v_a, v_b); it
=
v_b.begin();
for
(; it!=v_b.end(); ++
it) { std::cout
<<*it<<
"
"
; std::cout
<<
std::endl;
return
0
;
推荐文章
想表白的面包
·
js模拟键盘按下ctrl+v健_百度知道
2 年前
有腹肌的黄花菜
·
python--sys.stdout重定向_冰美式QAQ的博客-CSDN博客
2 年前