当前位置:网站首页>reduce_ Reduction in sum()_ indices

reduce_ Reduction in sum()_ indices

2022-06-22 06:07:00 Startled

Refer to this answer

https://www.zhihu.com/question/51325408/answer/125426642

reduction_indices, Literally, it means “ Collapse dimension ”, That is, according to which dimension to add .

Such as :

because square(y-x)=[1,4,9,16], It's a one-dimensional vector ( tensor ), therefore reduction_indices Can only be set to 0, Set other errors . The result is 30, That is to say 1 Dimension collapse is 0 dimension .

take xy Try a two-dimensional tensor :

here ,square(y-x)=[[1,4,9,16],[1,4,9,16]], Guess what the result is ? you 're right , According to 0 Dimensional collapse , namely “ That's ok ”, That is, the original n Row change 1 That's ok , I.e. by line sum, The answer for [2,8,18,32].

The lines , If reduction_indices=[1] Well ?

 

 

 

 

 

The answer is :[30,30], It can be understood as [[30],[30]].

over.

原网站

版权声明
本文为[Startled]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206220544017073.html